Submission #60995

#TimeUsernameProblemLanguageResultExecution timeMemory
60995TenuunRice Hub (IOI11_ricehub)C++17
0 / 100
41 ms8728 KiB
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; long long r=0, curr=0, cnt=0, res=0, i, mid, b; int* x; bool check(){ if((r-i)%2){ if(curr+x[r+1]-x[mid]<=b){ curr+=x[r+1]-x[mid]; cnt++; return true; } return false; } else{ if(curr+(x[mid+1]-x[mid])+x[r+1]-x[mid+1]<=b){ curr+=(x[mid+1]-x[mid])+x[r+1]-x[mid+1]; cnt++; mid++; return true; } return false; } } int besthub(int R, int L, int X[], long long B){ x=X; b=B; for(i=0; i<R; i++){ r=max(r, i); if(i==r){ mid=i; curr=0; cnt=1; } while(r+1<R && check()){ res=max(res, cnt); r++; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...