Submission #552397

#TimeUsernameProblemLanguageResultExecution timeMemory
552397WasrekRice Hub (IOI11_ricehub)C++14
0 / 100
7 ms508 KiB
#include<bits/stdc++.h> // #include "grader.cpp" #include "ricehub.h" using namespace std; int qs[100010]; int besthub(int R, int L, int X[], long long B) { for(int i=2;i<=R;i++){ qs[i]=qs[i-1]+(X[i-1]-X[i-2]); // printf("%d ",qs[i]); } // printf("\n"); int now=0,temp,ans=0; for(int i=1, j=1;i<=R && j<=R;i++){ if(i!=1){//move i now-=qs[(i+j)/2]-qs[i]; } if(j<i)j=i,now=0; temp=now; while(j<R){//move j temp+=(qs[j+1]-qs[(i+j+1)/2]); // printf("%d %d %d\n",i,j+1,temp); if(temp<=B) j++; else break; } // printf("%d %d\n",i,j); ans=max(ans,j-i+1); } return 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...