package yukicoder094; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); double[] x=new double[n]; double[] y=new double[n]; UnionFind uni=new UnionFind(n); for(int i=0;if[y]){ int d=x; x=y; y=d; } f[x]+=f[y]; f[y]=x; } return x!=y; } int root(int x){ return f[x]<0?x:root(f[x]); } } }