Submission #3466281


Source Code Expand

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

Submission Info

Submission Time
Task B - Union Find
User masu1208
Language C (GCC 5.4.1)
Score 100
Code Size 403 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;
 ^
./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;
          ^
./Main.c:1:12: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
 r[1<<17],p,a,b,i;
            ^
./Main.c:1:14: warning: type defaults to ‘int’ in declaration of ‘b’ [-Wimplicit-int]
 r[1<<17],p,a,b,i;
              ^
./Main.c:1:16: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
 r[1<<17],p,a,b,i;
                ^
./Main.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 f(x){
 ^
./Main.c: In function ‘f’:
./Main.c:2:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
./Main.c: At top level:
./Main.c:6:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main(n){
 ^
./Main.c: In function ‘main’:
./Main.c:6:1: warning: type of ‘n’ defaults to ‘...

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 512 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