Submission #660287

#TimeUsernameProblemLanguageResultExecution timeMemory
660287Trisanu_DasRice Hub (IOI11_ricehub)C++17
100 / 100
13 ms1752 KiB
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; int besthub(int n, int L, int x[], long long b){ int ans = 0; long long curr_cost = 0; for(int l = 0, r = 0; l < n; l++){ while(r + 1 < n && curr_cost + x[r + 1] - x[(l + r + 1) / 2] <= b){ curr_cost += x[r + 1] - x[(l + r + 1) / 2]; r++; ans = max(ans, r - l + 1); } curr_cost += x[l] - x[(r + l + 1) / 2]; } 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...