Submission #5311

#TimeUsernameProblemLanguageResultExecution timeMemory
5311baneling100줄 세우기 (KOI13_jul)C++98
22 / 22
180 ms12804 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...