package yukicoder; import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[] args){ new Main().solve(); } void solve(){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); DJSet ds=new DJSet(n); for(int i=0;iy d[y]+=d[x]; d[x]=y; } return x!=y; } boolean equiv(int x,int y){ return root(x)==root(y); } int size(int x){ return d[root(x)]*(-1); } //連結グラフの数 int count(){ int ct=0; for(int u:d){ if(u<0)ct++; } return ct; } } }