Submission #417744

#TimeUsernameProblemLanguageResultExecution timeMemory
417744Mohammed_AtalahRice Hub (IOI11_ricehub)C++17
68 / 100
1079 ms1740 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; int besthub(int R, int L, int X[], long long B) { int left = 0; int right = 0; int mx = R; int res = 0; while (right < mx && left < mx) { if (X[right] - X[left] > B) { left++; } int mid = left + ((right - left) / 2); int total = 0; int rice = 1; for (int i = left; i < mid; i++) { total += X[mid] - X[i]; rice++; } for (int i = mid + 1; i < right + 1; i++) { total += X[i] - X[mid]; rice++; } if (total > B) { left++; } else { right++; if (rice > res) { res = rice; } } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...