This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
int ar[1000001];
int aa[1000001];
int main()
{
int n,i,b,mx=0,cnt=0;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&ar[i]);
aa[ar[i]]=i;
}
cnt=1;
b=aa[1];
for(i=2;i<=n;i++){
if(b<aa[i]) cnt++;
else{
if(cnt>mx) mx=cnt;
cnt=1;
}
b=aa[i];
}
printf("%d",n-mx);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |