![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论——并查集
文章平均质量分 79
sdau_blue
念念不忘,必有回响。驰而不息,功不唐捐。
展开
-
C. Peaceful Rooks
C. Peaceful Rooks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given an×nn×nchessboard. Rows and columns of the board are numbered from11tonn. Cell(x,y)(x,y)lies on the...原创 2020-12-29 20:58:18 · 341 阅读 · 0 评论 -
Conquer a New Region(并查集+贪心)
并查集: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3659 Conquer a New Region Time Limit: 5 Seconds Memory Limit: 32768 KB The wheel of the history rolling forward, our king c...原创 2018-09-30 21:10:40 · 293 阅读 · 0 评论 -
食物链(并查集)
个人感觉这道题很经典。 http://poj.org/problem?id=1182 题目: 食物链 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 93459 Accepted: 28191 Description 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的...原创 2018-09-30 19:56:22 · 341 阅读 · 0 评论 -
并查集的基础用法
并查集: 1.小希的迷宫 题目大意:小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的设计图是否符合她的设计思路。 思路:利用并查集。 ①如果合并前两个房间已连通,不符合题意 ②然后全部合并一圈后再判断是否只有一个根节点。就是fa[i]=-1的点有多少个(下面代码中是set[i]==i的点),如果不是1那么说明还有没有连通的点。 ...原创 2018-04-19 21:25:35 · 417 阅读 · 1 评论 -
Work(简单并查集)
Work Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 6 Accepted Submission(s) : 2 Problem Description It’s an interesting experience to ...原创 2018-07-20 18:55:22 · 225 阅读 · 0 评论