D. Restructuring Company
http://codeforces.com/problemset/problem/566/D
题意: 三种操作,1,x,y:x与y连接;2,x,y:x~y连接;3,x,y:询问x与y是否连接;
思路:并查集;区间连接要优化,将区间[l,r]的每一个的下一个枚举修改为r,下次就可以直接跳到r;
#include<algorithm>
#include<set>
...
原创
2019-03-08 22:07:06 ·
186 阅读 ·
0 评论