Submission #3466345


Source Code Expand

r[1<<17],p,a,b,i;f(x){return r[x]!=x?r[x]=f(r[x]):x;}main(n){scanf("%d%*d",&n);for(i;i<n;i++)r[i]=i;for(;~scanf("%d%d%d",&p,&a,&b);)p?puts(f(a)==f(b)?"Yes":"No"):(r[f(a)]=f(b));}

Submission Info

Submission Time
Task B - Union Find
User masu1208
Language C (GCC 5.4.1)
Score 100
Code Size 178 Byte
Status AC
Exec Time 52 ms
Memory 1152 KB

Compile Error

./Main.c:1:1: warning: data definition has no type or storage class
 r[1<<17],p,a,b,i;f(x){return r[x]!=x?r[x]=f(r[x]):x;}main(n){scanf("%d%*d",&n);for(i;i<n;i++)r[i]=i;for(;~scanf("%d%d%d",&p,&a,&b);)p?puts(f(a)==f(b)?"Yes":"No"):(r[f(a)]=f(b));}
 ^
./Main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘r’ [-Wimplicit-int]
./Main.c:1:10: warning: type defaults to ‘int’ in declaration of ‘p’ [-Wimplicit-int]
 r[1<<17],p,a,b,i;f(x){return r[x]!=x?r[x]=f(r[x]):x;}main(n){scanf("%d%*d",&n);for(i;i<n;i++)r[i]=i;for(;~scanf("%d%d%d",&p,&a,&b);)p?puts(f(a)==f(b)?"Yes":"No"):(r[f(a)]=f(b));}
          ^
./Main.c:1:12: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
 r[1<<17],p,a,b,i;f(x){return r[x]!=x?r[x]=f(r[x]):x;}main(n){scanf("%d%*d",&n);for(i;i<n;i++)r[i]=i;for(;~scanf("%d%d%d",&p,&a,&b);)p?puts(f(a)==f(b)?"Yes":"No"):(r[f(a)]=f(b));}
            ^
./Main.c:1:14: warning: type defaults to ‘int’ in declaration of ‘b’ [-Wimplicit-int]
 r[1<<17],p,a,b,i;f(x){return r[x]!=x?r[x]=f...

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 1
AC × 19
Set Name Test Cases
Sample 00_sample_01.txt
All 00_sample_01.txt, subtask_01_01.txt, subtask_01_02.txt, subtask_01_03.txt, subtask_01_04.txt, subtask_01_05.txt, subtask_01_06.txt, subtask_01_07.txt, subtask_01_08.txt, subtask_01_09.txt, subtask_01_10.txt, subtask_01_11.txt, subtask_01_12.txt, subtask_01_13.txt, subtask_01_14.txt, subtask_01_15.txt, subtask_01_16.txt, subtask_01_17.txt, subtask_01_18.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 128 KB
subtask_01_01.txt AC 28 ms 512 KB
subtask_01_02.txt AC 1 ms 512 KB
subtask_01_03.txt AC 40 ms 896 KB
subtask_01_04.txt AC 48 ms 1152 KB
subtask_01_05.txt AC 3 ms 256 KB
subtask_01_06.txt AC 4 ms 640 KB
subtask_01_07.txt AC 44 ms 768 KB
subtask_01_08.txt AC 48 ms 1152 KB
subtask_01_09.txt AC 1 ms 128 KB
subtask_01_10.txt AC 1 ms 512 KB
subtask_01_11.txt AC 41 ms 768 KB
subtask_01_12.txt AC 48 ms 1152 KB
subtask_01_13.txt AC 36 ms 640 KB
subtask_01_14.txt AC 1 ms 512 KB
subtask_01_15.txt AC 42 ms 768 KB
subtask_01_16.txt AC 48 ms 1152 KB
subtask_01_17.txt AC 52 ms 896 KB
subtask_01_18.txt AC 47 ms 896 KB