2020牛客暑期多校训练营(第三场)G-Operating on a Graph(并查集)
题目链接
思路:
用并查集来记录哪些点是相同的颜色,用vecter来记录相邻的点。
代码:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N=8e5+7;
const double eps=1e-8;
const int mod=1e9+7;
const int
原创
2020-07-19 22:41:30 ·
251 阅读 ·
0 评论