![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
AcceptedQWQ
一直在前进
展开
-
swustoj亲戚(0369)
若某个家族人员过于庞大,要判断两个是否是亲戚,确实还很不容易,现在给出某个亲戚关系图,求任意给出的两个人是否具有亲戚关系。 规定:x和y是亲戚,y和z是亲戚,那么x和z也是亲戚。如果x,y是亲戚,那么x的亲戚都是y的亲戚,y的亲戚也都是x的亲戚。 Description第一行:三个整数n,m,p,(n以下m行:每行两个数Mi,Mj,1接下来p行:每行两个数Pi,Pj原创 2017-04-27 12:44:14 · 803 阅读 · 0 评论 -
E. Cyclic Components(并查集?)
E. Cyclic Componentstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an undirected graph consisting of nn vertices and mm edges. Your...原创 2018-05-07 15:45:58 · 945 阅读 · 0 评论