Submission #18551

#TimeUsernameProblemLanguageResultExecution timeMemory
18551eaststarGlobal Warming (NOI13_gw)C++14
40 / 40
314 ms12800 KiB
#include <stdio.h> #include <algorithm> using namespace std; struct data{ int h,i; bool operator<(const data&r)const{ return h<r.h; } }a[1000010]; int chk[1000010],ans,s=1; int main(){ int i,n; scanf("%d",&n); for(i=1;i<=n;++i)scanf("%d",&a[i].h),a[i].i=i,chk[i]=1; sort(a+1,a+n+1); for(i=1;i<=n;++i){ chk[a[i].i]=0; s+=chk[a[i].i-1]+chk[a[i].i+1]-1; if(a[i].h!=a[i+1].h&&ans<s)ans=s; } 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...