Submission #1133831

#TimeUsernameProblemLanguageResultExecution timeMemory
1133831domblyRice Hub (IOI11_ricehub)C++20
68 / 100
110 ms816 KiB
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; int besthub(int R, int L, int X[], long long B) { int ans = 0; for(int i = 0; i < R; i++) { int l = i - 1,r = i + 1; int b = B,cnt = 1; while(true) { if(l < 0) { if(r < R && X[r] - X[i] <= b) { cnt += 1; b -= X[r++] - X[i]; continue; } break; } if(r >= R) { if(l >= 0 && X[i] - X[l] <= b) { cnt += 1; b -= X[i] - X[l--]; continue; } break; } if(X[r] - X[i] < X[i] - X[l]) { if(X[r] - X[i] <= b) { cnt += 1; b -= X[r++] - X[i]; continue; } break; } if(X[i] - X[l] <= b) { cnt += 1; b -= X[i] - X[l--]; continue; } break; } ans = max(ans,cnt); } 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...