제출 #1129951

#제출 시각아이디문제언어결과실행 시간메모리
1129951Sofiatpc쌀 창고 (IOI11_ricehub)C++20
0 / 100
1 ms320 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9+5; 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) ){ int lv = INF, rv = INF; if(l >= 0)lv = m-x[l]; if(r < n)rv = x[r]-m; if(lv <= rv){ 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...