#include<stdio.h>
int N,x,y[1000001],i,S=1,M;
int main(void)
{
scanf("%d",&N);
for(i=1;i<=N;i++)
{
scanf("%d",&x);
y[x]=i;
}
for(i=1;i<N;i++)
{
if(y[i]>y[i+1])
S=1;
else
{
S++;
if(S>M)
M=S;
}
}
printf("%d",N-M);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4992 KB |
Output is correct |
2 |
Correct |
0 ms |
4992 KB |
Output is correct |
3 |
Correct |
0 ms |
4992 KB |
Output is correct |
4 |
Correct |
0 ms |
4992 KB |
Output is correct |
5 |
Correct |
0 ms |
4992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4992 KB |
Output is correct |
2 |
Correct |
0 ms |
4992 KB |
Output is correct |
3 |
Correct |
0 ms |
4992 KB |
Output is correct |
4 |
Correct |
0 ms |
4992 KB |
Output is correct |
5 |
Correct |
0 ms |
4992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4992 KB |
Output is correct |
2 |
Correct |
0 ms |
4992 KB |
Output is correct |
3 |
Correct |
0 ms |
4992 KB |
Output is correct |
4 |
Correct |
0 ms |
4992 KB |
Output is correct |
5 |
Correct |
0 ms |
4992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4992 KB |
Output is correct |
2 |
Correct |
4 ms |
4992 KB |
Output is correct |
3 |
Correct |
8 ms |
4992 KB |
Output is correct |
4 |
Correct |
24 ms |
4992 KB |
Output is correct |
5 |
Correct |
44 ms |
4992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
88 ms |
4992 KB |
Output is correct |
2 |
Correct |
116 ms |
4992 KB |
Output is correct |
3 |
Correct |
148 ms |
4992 KB |
Output is correct |
4 |
Correct |
176 ms |
4992 KB |
Output is correct |
5 |
Correct |
176 ms |
4992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
176 ms |
4992 KB |
Output is correct |
2 |
Correct |
160 ms |
4992 KB |
Output is correct |
3 |
Correct |
180 ms |
4992 KB |
Output is correct |
4 |
Correct |
160 ms |
4992 KB |
Output is correct |
5 |
Correct |
172 ms |
4992 KB |
Output is correct |