Submission #672028

#TimeUsernameProblemLanguageResultExecution timeMemory
672028Hacv16Rice Hub (IOI11_ricehub)C++17
68 / 100
1091 ms572 KiB
#include<bits/stdc++.h> #include "ricehub.h" using namespace std; typedef long long ll; const ll INF = 5e18 + 15; int besthub(int n, int l, int x[], ll b){ ll ans = 0; for(int mid = 0; mid < n; mid++){ ll cnt = 1, l = mid - 1, r = mid + 1; ll av = b; while(av >= 0 && (l >= 0 || r < n)){ ll dl = (l >= 0 ? x[mid] - x[l] : INF); ll dr = (r < n ? x[r] - x[mid] : INF); if(av - min(dl, dr) < 0) break; av -= min(dl, dr); if(dl < dr) l--; else r++; cnt++; } ans = max(ans, cnt); } return (int) 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...