[WC2005]双面棋盘,洛谷P4121,线段树分治+可撤销并查集
正题
这题主要是来练手的,因为没写过可撤销的并查集,大概就是把每一个格子看成一个点,然后格子直接的边有很多的出现区间,把这些出现区间和对应的颜色打到线段树上,然后用可撤销的并查集来维护就可以了.
#include<bits/stdc++.h>
#define ls now<<1
#define rs now<<1|1
using namespace std;
#define pib pair<int,bool>
const int N=20...
原创
2020-09-01 21:49:14 ·
236 阅读 ·
0 评论