目录
例题:hdu 1213
//#include <bits/stdc++.h>
#include <iostream>
#include <stack>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <string.h>
using namespace std;
const int MAXN = 1005;
int s[MAXN];
void init_set(){
for(int i = 1; i <= MAXN; i++)
s[i] = i;
}
int find_set(int x){
return x = s[x]? x: find_set(s[x]);
}
void union_set(int x, int y){
x = find_set(x);
y = find_set(y);
if(x != y) s[x] = s[y];
}
int main(){
int t, n, m, x, y;
cin >> t;
while(t--){
cin >> n >> m;