#include<stdio.h>
int ar[1000001];
int aa[1000001];
int main()
{
int n,i,b,mx=0,cnt=0;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&ar[i]);
aa[ar[i]]=i;
}
cnt=1;
b=aa[1];
for(i=2;i<=n;i++){
if(b<aa[i]) cnt++;
else{
if(cnt>mx) mx=cnt;
cnt=1;
}
b=aa[i];
}
printf("%d",n-mx);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
8696 KB |
Output is correct |
2 |
Correct |
0 ms |
8696 KB |
Output is correct |
3 |
Correct |
0 ms |
8696 KB |
Output is correct |
4 |
Correct |
0 ms |
8696 KB |
Output is correct |
5 |
Correct |
0 ms |
8696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
8696 KB |
Output is correct |
2 |
Correct |
0 ms |
8696 KB |
Output is correct |
3 |
Correct |
0 ms |
8696 KB |
Output is correct |
4 |
Correct |
0 ms |
8696 KB |
Output is correct |
5 |
Correct |
0 ms |
8696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8696 KB |
Output is correct |
2 |
Correct |
1 ms |
8696 KB |
Output is correct |
3 |
Correct |
1 ms |
8696 KB |
Output is correct |
4 |
Correct |
1 ms |
8696 KB |
Output is correct |
5 |
Correct |
1 ms |
8696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8696 KB |
Output is correct |
2 |
Correct |
5 ms |
8696 KB |
Output is correct |
3 |
Correct |
11 ms |
8696 KB |
Output is correct |
4 |
Correct |
31 ms |
8696 KB |
Output is correct |
5 |
Correct |
56 ms |
8696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
88 ms |
8696 KB |
Output is correct |
2 |
Correct |
126 ms |
8696 KB |
Output is correct |
3 |
Correct |
164 ms |
8696 KB |
Output is correct |
4 |
Correct |
189 ms |
8696 KB |
Output is correct |
5 |
Correct |
185 ms |
8696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
196 ms |
8696 KB |
Output is correct |
2 |
Correct |
188 ms |
8696 KB |
Output is correct |
3 |
Correct |
186 ms |
8696 KB |
Output is correct |
4 |
Correct |
188 ms |
8696 KB |
Output is correct |
5 |
Correct |
187 ms |
8696 KB |
Output is correct |