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 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;
}
# | 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... |