Code Festival B Union Find by hec

a,b,p[1<<18];main(c,d){for(gets(d);p[b]?b=p[b]:p[c]?c=p[c]:~scanf("%d%d%d",&a,&b,&c,a?puts(b-c?"NO":"YES"):b-c?p[b]=c:0););}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page