Submission #4274

#TimeUsernameProblemLanguageResultExecution timeMemory
4274ansol4328줄 세우기 (KOI13_jul)C++98
22 / 22
176 ms12804 KiB
#include<stdio.h> int n, m[1000002]; int p[1000002]; int dy[1000002]; int max; int input() { int i; scanf("%d",&n); for(i=1 ; i<=n ; i++) { scanf("%d",&m[i]); p[m[i]]=i; } return 0; } int process() { int i; for(i=1 ; i<=n ; i++) { dy[i]=1; if(p[i-1]<p[i] && dy[i]<dy[i-1]+1) { dy[i]=dy[i-1]+1; } if(max<dy[i]) { max=dy[i]; } } return 0; } int output() { printf("%d",n-max); return 0; } int main() { 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...