Submission #491344

#TimeUsernameProblemLanguageResultExecution timeMemory
491344dennisstarRice Hub (IOI11_ricehub)C++17
0 / 100
3 ms588 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int besthub(int n, int l, int x[], ll b) { vector<ll> v(n); for (int i=0; i<n; i++) v[i]=x[i]+(i?v[i-1]:0); auto get = [&](int s, int e) { return v[e]-(s?v[s-1]:0); }; int mx=0; for (int i=0; i<n; i++) { int s=i, e=n-1; while (s<e) { int m=(s+e+1)/2; if (get((s+m+1)/2, m)-get(s, (s+m)/2)>b) e=m-1; else s=m; } mx=max(mx, s-i+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...