Submission #16513

#TimeUsernameProblemLanguageResultExecution timeMemory
16513khsoo01Rice Hub (IOI11_ricehub)C++98
100 / 100
26 ms6552 KiB
#include "ricehub.h" long long s,e,sum[100005],x[100005],mx; inline long long max(long long X,long long Y) { return X>Y?X:Y; } long long calc(int X,int Y) { long long k=(Y-X+1)/2; return sum[Y]-sum[Y-k]-sum[X+k-1]+sum[X-1]; } int besthub(int R, int L, int X[], long long B) { int i; for(i=0;i<R;i++) { x[i+1]=X[i]; sum[i+1]=sum[i]+x[i+1]; } s=1; e=1; while(s<=R && e<=R) { if(calc(s,e)<=B) { mx=max(mx,e-s+1); e++; } else { s++; } } return mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...