Submission #145560

#TimeUsernameProblemLanguageResultExecution timeMemory
145560surface03줄 세우기 (KOI13_jul)C++14
22 / 22
169 ms15036 KiB
#include<bits/stdc++.h> using namespace std; int a[1000010],b[1000010]; int main(){ int n,x,i,ans=0; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d",&x); a[x]=i; } b[1]=1; for(i=2;i<=n;i++){ if(a[i-1]<a[i])b[i]=b[i-1]+1; else b[i]=1; ans=max(ans,b[i]); } printf("%d",n-ans); }

Compilation message (stderr)

jul.cpp: In function 'int main()':
jul.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
jul.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
         ~~~~~^~~~~~~~~
#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...