Submission #953904

#TimeUsernameProblemLanguageResultExecution timeMemory
9539044QT0RRice Hub (IOI11_ricehub)C++17
0 / 100
2 ms2652 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll pref[100003]; ll pos[100003]; ll cost(ll l, ll p){ ll med=(l+p)/2; return pref[p]-pref[l-1]-(p-l+1)*pos[med]; } ll besthub(int n, int L, int x[], ll bud){ for (ll i = 0; i<n; i++){ pos[i+1]=x[i]; pref[i+1]=pref[i]+x[i]; } ll mx=1,p=1; for (ll l = 1; l<=n; l++){ while(p<n && cost(l,p+1)<=bud)p++; mx=max(mx,p-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...