Submission #761342

#TimeUsernameProblemLanguageResultExecution timeMemory
761342KN200711Rice Hub (IOI11_ricehub)C++14
100 / 100
11 ms2516 KiB
#include "ricehub.h" # include <bits/stdc++.h> # define ll long long using namespace std; int l, r, pos; ll pc[200001], val; void ad() { r++; val += pc[r] - pc[pos]; if((r - l + 1)&1) { // dimajuin pos nya val -= pc[pos + 1] - pc[pos]; pos++; } return; } void mn() { val -= pc[pos] - pc[l]; l++; if((r - l + 1)&1) { // dimajuin pos nya val -= pc[pos + 1] - pc[pos]; pos++; } } int besthub(int R, int L, int X[], ll B) { for(int i=0;i<R;i++) pc[i] = X[i]; val = 0ll; l = r = pos= 0; int mx = 0; for(int i=1;i<R;i++) { ad(); while(val > B) mn(); mx = max(mx, r - l + 1); } 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...