Submission #1835

#TimeUsernameProblemLanguageResultExecution timeMemory
1835alephnull줄 세우기 (KOI13_jul)C++98
22 / 22
219 ms12532 KiB
#include <cstdio> int main(){ int n;scanf("%d",&n); int a[n]; int inv[n]; for(int i=0;i<n;i++){scanf("%d",a+i);inv[a[i]]=i;} int dp[n+1]; dp[1]=1; int ans=1; for(int i=2;i<n;i++){ if(inv[i]>inv[i-1])dp[i]=dp[i-1]+1; else dp[i]=1; if(ans<dp[i])ans=dp[i]; } printf("%d",n-ans); }
#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...