Submission #1268687


Source Code Expand

q[1<<18],t[1<<18],f[1<<18];i,a;
main(n){
	for(scanf("%d",&n);~scanf("%d",&a);i++)q[a]=i;
	for(f[n]=n;--i;t[a]?q[f[a]]<q[i]&q[i]<q[a]|q[i]<q[a]&q[a]<q[f[a]]|q[a]<q[f[a]]&q[f[a]]<q[i]?t[i]=t[a],f[i]=f[a]:(t[i]=t[f[i]=i+1]+1):q[i]<q[a]?t[i]=0,f[i]=i:(f[i]=i+(t[i]=1)))a=i+1;
	printf("%d",t[1]);
}

Submission Info

Submission Time
Task F - Strange Sorting
User kotatsugame
Language C (GCC 5.4.1)
Score 2400
Code Size 298 Byte
Status AC
Exec Time 23 ms
Memory 2560 KB

Compile Error

./Main.c:1:1: warning: data definition has no type or storage class
 q[1<<18],t[1<<18],f[1<<18];i,a;
 ^
./Main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘q’ [-Wimplicit-int]
./Main.c:1:10: warning: type defaults to ‘int’ in declaration of ‘t’ [-Wimplicit-int]
 q[1<<18],t[1<<18],f[1<<18];i,a;
          ^
./Main.c:1:19: warning: type defaults to ‘int’ in declaration of ‘f’ [-Wimplicit-int]
 q[1<<18],t[1<<18],f[1<<18];i,a;
                   ^
./Main.c:1:28: warning: data definition has no type or storage class
 q[1<<18],t[1<<18],f[1<<18];i,a;
                            ^
./Main.c:1:28: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
./Main.c:1:30: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
 q[1<<18],t[1<<18],f[1<<18];i,a;
                              ^
./Main.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main(n){
 ^
./Main.c: In function ‘main’:
./Main.c:2:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
./Main...

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 2400 / 2400
Status
AC × 3
AC × 29
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in2.txt, in20.txt, in21.txt, in22.txt, in23.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
in1.txt AC 23 ms 2560 KB
in10.txt AC 23 ms 2560 KB
in11.txt AC 23 ms 2560 KB
in12.txt AC 23 ms 2560 KB
in13.txt AC 23 ms 2560 KB
in14.txt AC 23 ms 2560 KB
in15.txt AC 23 ms 2560 KB
in16.txt AC 23 ms 2560 KB
in17.txt AC 23 ms 2560 KB
in18.txt AC 23 ms 2560 KB
in19.txt AC 23 ms 2560 KB
in2.txt AC 23 ms 2560 KB
in20.txt AC 23 ms 2560 KB
in21.txt AC 20 ms 2560 KB
in22.txt AC 21 ms 2560 KB
in23.txt AC 1 ms 128 KB
in3.txt AC 23 ms 2560 KB
in4.txt AC 23 ms 2560 KB
in5.txt AC 23 ms 2560 KB
in6.txt AC 23 ms 2560 KB
in7.txt AC 23 ms 2560 KB
in8.txt AC 23 ms 2560 KB
in9.txt AC 23 ms 2560 KB
sample1.txt AC 1 ms 128 KB
sample2.txt AC 1 ms 128 KB
sample3.txt AC 1 ms 128 KB