#include <cstdio>
#include <algorithm>
using namespace std;
int d[1000001];
int main(){
int N,a,ans=0;
scanf("%d",&N);
for(int i=0;i<N;i++){
scanf("%d",&a);
d[a]=d[a-1]+1;
ans = max(ans,d[a]);
}
printf("%d",N-ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4988 KB |
Output is correct |
2 |
Correct |
0 ms |
4988 KB |
Output is correct |
3 |
Correct |
0 ms |
4988 KB |
Output is correct |
4 |
Correct |
0 ms |
4988 KB |
Output is correct |
5 |
Correct |
0 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4988 KB |
Output is correct |
2 |
Correct |
0 ms |
4988 KB |
Output is correct |
3 |
Correct |
0 ms |
4988 KB |
Output is correct |
4 |
Correct |
0 ms |
4988 KB |
Output is correct |
5 |
Correct |
0 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4988 KB |
Output is correct |
2 |
Correct |
0 ms |
4988 KB |
Output is correct |
3 |
Correct |
0 ms |
4988 KB |
Output is correct |
4 |
Correct |
0 ms |
4988 KB |
Output is correct |
5 |
Correct |
1 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4988 KB |
Output is correct |
2 |
Correct |
3 ms |
4988 KB |
Output is correct |
3 |
Correct |
10 ms |
4988 KB |
Output is correct |
4 |
Correct |
24 ms |
4988 KB |
Output is correct |
5 |
Correct |
49 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
66 ms |
4988 KB |
Output is correct |
2 |
Correct |
110 ms |
4988 KB |
Output is correct |
3 |
Correct |
180 ms |
4988 KB |
Output is correct |
4 |
Correct |
129 ms |
4988 KB |
Output is correct |
5 |
Correct |
117 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
4988 KB |
Output is correct |
2 |
Correct |
157 ms |
4988 KB |
Output is correct |
3 |
Correct |
152 ms |
4988 KB |
Output is correct |
4 |
Correct |
215 ms |
4988 KB |
Output is correct |
5 |
Correct |
163 ms |
4988 KB |
Output is correct |