Submission #5007

#TimeUsernameProblemLanguageResultExecution timeMemory
5007cki86201Global Warming (NOI13_gw)C++98
40 / 40
448 ms9876 KiB
#include<stdio.h> #include<algorithm> int inp[1000010], ord[1000010]; bool chk[1000010]; bool comp(const int &a,const int &b){return inp[a]<inp[b];} int main() { int n,i; scanf("%d",&n); for(i=1;i<=n;i++)scanf("%d",inp+i), ord[i] = i; std::sort(ord+1,ord+1+n,comp); int now=1,ans=1; chk[0]=chk[n+1]=1; for(i=1;i<=n;i++){ int t = ord[i]; now+=1-chk[t-1]-chk[t+1]; chk[t]=1; if(i==n || inp[t]!=inp[ord[i+1]])ans=std::max(ans,now); } printf("%d",ans); 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...