摘要: 用并查集记录每个联通块的根节点,每个联通块建一棵线段树,合并时合并线段树就可以了。 代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 #define N 100010 6 阅读全文
posted @ 2017-03-04 08:47 gjghfd 阅读(201) 评论(0) 推荐(1)