제출 #319170

#제출 시각아이디문제언어결과실행 시간메모리
319170Temmie쌀 창고 (IOI11_ricehub)C++17
100 / 100
17 ms2540 KiB
#include <bits/stdc++.h> typedef long long ll; ll get(int x, int y, int* a, ll* b) { return ((((x + y) >> 1) - x + 1) - (y - ((x + y) >> 1))) * a[(x + y) >> 1] - (b[(x + y) >> 1] - (x ? b[x - 1] : 0)) + (b[y] - b[(x + y) >> 1]); } int besthub(int r, int l, int* x, ll b) { ll a[r], sum; a[0] = x[0]; for (int i = 1; i < r; i++) a[i] = a[i - 1] + x[i]; int i = 0, ans = 0; for (int j = 0; j < r; j++) { sum = get(i, j, x, a); while (sum > b) i++, sum = get(i, j, x, a); ans = std::max(ans, j - i + 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...