#include <stdio.h>
int a[1000010],chk[1000010],s[1000010],mx;
int main(){
int i,n;
scanf("%d",&n);
for(i=1;i<=n;++i){
scanf("%d",&a[i]);
chk[a[i]]=1;
if(chk[a[i]-1])s[a[i]]=s[a[i]-1]+1;
if(mx<s[a[i]])mx=s[a[i]];
}
printf("%d",n-mx-1);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
12800 KB |
Output is correct |
2 |
Correct |
0 ms |
12800 KB |
Output is correct |
3 |
Correct |
0 ms |
12800 KB |
Output is correct |
4 |
Correct |
0 ms |
12800 KB |
Output is correct |
5 |
Correct |
0 ms |
12800 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
12800 KB |
Output is correct |
2 |
Correct |
0 ms |
12800 KB |
Output is correct |
3 |
Correct |
0 ms |
12800 KB |
Output is correct |
4 |
Correct |
0 ms |
12800 KB |
Output is correct |
5 |
Correct |
0 ms |
12800 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12800 KB |
Output is correct |
2 |
Correct |
0 ms |
12800 KB |
Output is correct |
3 |
Correct |
4 ms |
12800 KB |
Output is correct |
4 |
Correct |
2 ms |
12800 KB |
Output is correct |
5 |
Correct |
0 ms |
12800 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
12800 KB |
Output is correct |
2 |
Correct |
7 ms |
12800 KB |
Output is correct |
3 |
Correct |
12 ms |
12800 KB |
Output is correct |
4 |
Correct |
26 ms |
12800 KB |
Output is correct |
5 |
Correct |
66 ms |
12800 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
86 ms |
12800 KB |
Output is correct |
2 |
Correct |
117 ms |
12800 KB |
Output is correct |
3 |
Correct |
159 ms |
12800 KB |
Output is correct |
4 |
Correct |
167 ms |
12800 KB |
Output is correct |
5 |
Correct |
178 ms |
12800 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
175 ms |
12800 KB |
Output is correct |
2 |
Correct |
165 ms |
12800 KB |
Output is correct |
3 |
Correct |
161 ms |
12800 KB |
Output is correct |
4 |
Correct |
129 ms |
12800 KB |
Output is correct |
5 |
Correct |
0 ms |
12800 KB |
Output is correct |