# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
272744 | 2020-08-18T15:02:03 Z | toonewbie | 쌀 창고 (IOI11_ricehub) | C++17 | 24 ms | 3072 KB |
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; const int N = 100005; int arr[N]; long long pref[N]; int besthub(int n, int l, int X[], long long m){ for (int i = 1; i <= n; i++) { arr[i] = X[i - 1]; pref[i] = pref[i - 1] + arr[i]; } int res = 0; for (int i = 1; i <= n; i++) { int l = i, r = n, j; while (r - l >= 0) { int mid = (l + r) >> 1; int mmid = (i + mid) >> 1; long long cost = 1LL * arr[mmid] * (mmid - i + 1) - (pref[mmid] - pref[i - 1]); cost += (pref[mid] - pref[mmid]) - 1LL * arr[mmid] * (mid - mmid); if (cost <= m) { j = mid; l = mid + 1; } else { r = mid - 1; } } res = max(res, j - i + 1); } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 0 ms | 384 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 1 ms | 384 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 1 ms | 384 KB | Output is correct |
23 | Correct | 1 ms | 360 KB | Output is correct |
24 | Correct | 1 ms | 384 KB | Output is correct |
25 | Correct | 1 ms | 384 KB | Output is correct |
26 | Correct | 1 ms | 384 KB | Output is correct |
27 | Correct | 1 ms | 384 KB | Output is correct |
28 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 1 ms | 384 KB | Output is correct |
18 | Correct | 1 ms | 380 KB | Output is correct |
19 | Correct | 1 ms | 384 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 2 ms | 384 KB | Output is correct |
23 | Correct | 2 ms | 384 KB | Output is correct |
24 | Correct | 2 ms | 512 KB | Output is correct |
25 | Correct | 2 ms | 512 KB | Output is correct |
26 | Correct | 2 ms | 512 KB | Output is correct |
27 | Correct | 2 ms | 512 KB | Output is correct |
28 | Correct | 2 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 768 KB | Output is correct |
2 | Correct | 5 ms | 768 KB | Output is correct |
3 | Correct | 24 ms | 2944 KB | Output is correct |
4 | Correct | 24 ms | 3072 KB | Output is correct |
5 | Correct | 11 ms | 1408 KB | Output is correct |
6 | Correct | 11 ms | 1408 KB | Output is correct |
7 | Correct | 21 ms | 2688 KB | Output is correct |
8 | Correct | 21 ms | 2688 KB | Output is correct |
9 | Correct | 10 ms | 1408 KB | Output is correct |
10 | Correct | 10 ms | 1408 KB | Output is correct |
11 | Correct | 24 ms | 2944 KB | Output is correct |
12 | Correct | 23 ms | 2944 KB | Output is correct |
13 | Correct | 11 ms | 1536 KB | Output is correct |
14 | Correct | 12 ms | 1536 KB | Output is correct |
15 | Correct | 18 ms | 2304 KB | Output is correct |
16 | Correct | 18 ms | 2304 KB | Output is correct |
17 | Correct | 22 ms | 2688 KB | Output is correct |
18 | Correct | 21 ms | 2688 KB | Output is correct |
19 | Correct | 23 ms | 2808 KB | Output is correct |
20 | Correct | 22 ms | 2816 KB | Output is correct |