Submission #977542

#TimeUsernameProblemLanguageResultExecution timeMemory
977542AmaarsaaRice Hub (IOI11_ricehub)C++14
68 / 100
1089 ms3612 KiB
#include<bits/stdc++.h> #include "ricehub.h" using namespace std; using ll = long long; int besthub(int R, int L, int X[], long long B) { ll s; int ans = 0, mn, l, r; for (int i = 0; i + 1 < R; i ++) { l = i; r = i + 1; s = 0; while (l >= 0 && r < R && s + (X[r]- X[l]) <= B) { s += (X[r] - X[l]); l --; r ++; } mn = INT_MAX; if ( l >= 0) { mn = min(mn, X[i] - X[l]); } if ( r < R) { mn = min(mn, X[r] - X[i + 1]); } if (mn + s <= B) { ans = max(ans, r - l); } else 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...