#include <stdio.h>
FILE * in = stdin;
FILE * out = stdout;
int n, a[1000000], d[1000001];
int ans;
int main(){
int i;
fscanf(in, "%d", &n);
for (i=0; i<n; i++) fscanf(in, "%d", &a[i]);
ans = n;
for (i=0; i<n; i++){
d[a[i]] = d[a[i]-1]+1;
if (ans>n-d[a[i]]) ans = n-d[a[i]];
}
fprintf(out, "%d", ans);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 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 |
2 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 |
6 ms |
8696 KB |
Output is correct |
3 |
Correct |
12 ms |
8696 KB |
Output is correct |
4 |
Correct |
28 ms |
8696 KB |
Output is correct |
5 |
Correct |
49 ms |
8696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
87 ms |
8696 KB |
Output is correct |
2 |
Correct |
112 ms |
8696 KB |
Output is correct |
3 |
Correct |
142 ms |
8696 KB |
Output is correct |
4 |
Correct |
169 ms |
8696 KB |
Output is correct |
5 |
Correct |
167 ms |
8696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
178 ms |
8696 KB |
Output is correct |
2 |
Correct |
170 ms |
8696 KB |
Output is correct |
3 |
Correct |
172 ms |
8696 KB |
Output is correct |
4 |
Correct |
162 ms |
8696 KB |
Output is correct |
5 |
Correct |
170 ms |
8696 KB |
Output is correct |