Submission #1129950

#TimeUsernameProblemLanguageResultExecution timeMemory
1129950SofiatpcRice Hub (IOI11_ricehub)C++20
0 / 100
0 ms320 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; int besthub(int n, int L, int x[], ll b) { int m, l = n/2-1, r = n/2; if(n%2 == 1)m = x[n/2]; else m = (x[n/2]+x[n/2-1])/2; int ans = 0; while( (l >= 0 && b >= m-x[l]) || ( r < n && b >= x[r]-m) ){ if(l >= 0 && m-x[l] <= x[r]-m){ b -= m-x[l]; l--; }else{ b -= x[r]-m; r++; } ans++; } 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...