#include <stdio.h>
int n, a[1000001], b[1000001], d[1000001], ans;
void input(void)
{
int i;
scanf("%d",&n);
for(i=1 ; i<=n ; i++)
{
scanf("%d",&a[i]);
b[a[i]]=i;
}
}
void process(void)
{
int i;
for(i=1 ; i<=n ; i++)
{
if(b[a[i]-1]<i)
d[a[i]]=d[a[i]-1]+1;
else
d[a[i]]=1;
}
for(i=1 ; i<=n ; i++)
if(ans<d[i])
ans=d[i];
}
void output(void)
{
printf("%d",n-ans);
}
int main(void)
{
input();
process();
output();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
12804 KB |
Output is correct |
2 |
Correct |
0 ms |
12804 KB |
Output is correct |
3 |
Correct |
0 ms |
12804 KB |
Output is correct |
4 |
Correct |
0 ms |
12804 KB |
Output is correct |
5 |
Correct |
0 ms |
12804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
12804 KB |
Output is correct |
2 |
Correct |
0 ms |
12804 KB |
Output is correct |
3 |
Correct |
0 ms |
12804 KB |
Output is correct |
4 |
Correct |
0 ms |
12804 KB |
Output is correct |
5 |
Correct |
0 ms |
12804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
12804 KB |
Output is correct |
2 |
Correct |
0 ms |
12804 KB |
Output is correct |
3 |
Correct |
0 ms |
12804 KB |
Output is correct |
4 |
Correct |
0 ms |
12804 KB |
Output is correct |
5 |
Correct |
0 ms |
12804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
12804 KB |
Output is correct |
2 |
Correct |
4 ms |
12804 KB |
Output is correct |
3 |
Correct |
8 ms |
12804 KB |
Output is correct |
4 |
Correct |
20 ms |
12804 KB |
Output is correct |
5 |
Correct |
48 ms |
12804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
80 ms |
12804 KB |
Output is correct |
2 |
Correct |
116 ms |
12804 KB |
Output is correct |
3 |
Correct |
136 ms |
12804 KB |
Output is correct |
4 |
Correct |
156 ms |
12804 KB |
Output is correct |
5 |
Correct |
180 ms |
12804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
168 ms |
12804 KB |
Output is correct |
2 |
Correct |
168 ms |
12804 KB |
Output is correct |
3 |
Correct |
156 ms |
12804 KB |
Output is correct |
4 |
Correct |
152 ms |
12804 KB |
Output is correct |
5 |
Correct |
168 ms |
12804 KB |
Output is correct |