#import<cstdio>
int n,r[1000001],m[1000001],b,x,i;
main(){
scanf("%d",&n);
for(i=0;i<n;) scanf("%d",&b),r[b]=i++;
for(i=1;i<=n;i++)m[i]=(r[i]>r[i-1])?m[i-1]+1:1,(x<m[i])?x=m[i]:0;
printf("%d",n-x);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
8900 KB |
Output is correct |
2 |
Correct |
0 ms |
8900 KB |
Output is correct |
3 |
Correct |
0 ms |
8900 KB |
Output is correct |
4 |
Correct |
0 ms |
8900 KB |
Output is correct |
5 |
Correct |
0 ms |
8900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
8900 KB |
Output is correct |
2 |
Correct |
0 ms |
8900 KB |
Output is correct |
3 |
Correct |
0 ms |
8900 KB |
Output is correct |
4 |
Correct |
0 ms |
8900 KB |
Output is correct |
5 |
Correct |
0 ms |
8900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
8900 KB |
Output is correct |
2 |
Correct |
0 ms |
8900 KB |
Output is correct |
3 |
Correct |
0 ms |
8900 KB |
Output is correct |
4 |
Correct |
0 ms |
8900 KB |
Output is correct |
5 |
Correct |
0 ms |
8900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
8900 KB |
Output is correct |
2 |
Correct |
4 ms |
8900 KB |
Output is correct |
3 |
Correct |
8 ms |
8900 KB |
Output is correct |
4 |
Correct |
28 ms |
8900 KB |
Output is correct |
5 |
Correct |
44 ms |
8900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
80 ms |
8900 KB |
Output is correct |
2 |
Correct |
108 ms |
8900 KB |
Output is correct |
3 |
Correct |
140 ms |
8900 KB |
Output is correct |
4 |
Correct |
168 ms |
8900 KB |
Output is correct |
5 |
Correct |
164 ms |
8900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
148 ms |
8900 KB |
Output is correct |
2 |
Correct |
172 ms |
8900 KB |
Output is correct |
3 |
Correct |
176 ms |
8900 KB |
Output is correct |
4 |
Correct |
176 ms |
8900 KB |
Output is correct |
5 |
Correct |
164 ms |
8900 KB |
Output is correct |