Submission #888953

#TimeUsernameProblemLanguageResultExecution timeMemory
888953dwuyRice Hub (IOI11_ricehub)C++14
100 / 100
11 ms5724 KiB
/// dwuy: _,\,,,_\,__,\,,_ #include <bits/stdc++.h> #define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL) #define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout) #define fi first #define se second #define endl "\n" #define len(s) int32_t(s.length()) #define MASK(k)(1LL<<(k)) #define TASK "" using namespace std; typedef tuple<int, int, int> tpiii; typedef pair<double, double> pdd; typedef pair<int, int> pii; typedef long long ll; const long long OO = 1e18; const int MOD = 1e9 + 7; const int INF = 1e9; const int MX = 200005; ll n, l, money; ll a[MX]; ll sum[MX]; ll get(ll l, ll r){ return sum[r] - sum[l-1]; } ll cost(ll l, ll r){ ll mid = (l+r)>>1; return get(mid+1, r) - get(l, mid - ((r-l+1)&1)); } ll besthub(int N, int L, int X[], ll B){ n = N; l = L; money = B; for(ll i=1; i<=n; i++){ a[i] = X[i-1]; sum[i] = sum[i-1] + a[i]; } ll ans = 0; for(ll l=1, r=1; r<=n; r++){ while(cost(l, r)>money) l++; ans = max(ans, r-l+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...