# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
443037 | 2021-07-09T14:03:56 Z | hibye1217 | 쌀 창고 (IOI11_ricehub) | C++17 | 16 ms | 2508 KB |
#ifndef NOTSUBMIT #include "ricehub.h" #include <bits/stdc++.h> using namespace std; #endif // NOTSUBMIT typedef long long ll; ll sum[100020]; int besthub(int R, int L, int X[], ll B){ for (int i = 1; i <= R; i++){ sum[i] = sum[i-1] + X[i-1]; } int st = 1, ed = R, ans = 1; while (st <= ed){ int mid = st + ed >> 1; ll res = 1e18; for (int e = mid; e <= R; e++){ int s = e-mid+1; int m = s+e >> 1; int lc = m-s+1, rc = e-m; ll ls = lc*X[m-1] - (sum[m]-sum[s-1]); ll rs = (sum[e]-sum[m]) - rc*X[m-1]; //cout << "RS " << sum[e] << ' ' << sum[m] << ' ' << rc << ' ' << X[m] << endl; //cout << "MID " << s << ' ' << m << ' ' << e << " = " << ls<<' '<<rs << endl; res = min(res, ls+rs); } if (res <= B){ st = mid+1; ans = mid; } else{ ed = mid-1; } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 304 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 296 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 300 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 204 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 300 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 300 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 304 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 1 ms | 204 KB | Output is correct |
24 | Correct | 1 ms | 204 KB | Output is correct |
25 | Correct | 1 ms | 204 KB | Output is correct |
26 | Correct | 1 ms | 204 KB | Output is correct |
27 | Correct | 0 ms | 204 KB | Output is correct |
28 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 332 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 1 ms | 332 KB | Output is correct |
24 | Correct | 1 ms | 332 KB | Output is correct |
25 | Correct | 1 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 412 KB | Output is correct |
27 | Correct | 2 ms | 332 KB | Output is correct |
28 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 588 KB | Output is correct |
2 | Correct | 4 ms | 716 KB | Output is correct |
3 | Correct | 16 ms | 2508 KB | Output is correct |
4 | Correct | 16 ms | 2492 KB | Output is correct |
5 | Correct | 9 ms | 1220 KB | Output is correct |
6 | Correct | 9 ms | 1228 KB | Output is correct |
7 | Correct | 14 ms | 2256 KB | Output is correct |
8 | Correct | 14 ms | 2252 KB | Output is correct |
9 | Correct | 8 ms | 1100 KB | Output is correct |
10 | Correct | 8 ms | 1104 KB | Output is correct |
11 | Correct | 16 ms | 2508 KB | Output is correct |
12 | Correct | 16 ms | 2476 KB | Output is correct |
13 | Correct | 13 ms | 1220 KB | Output is correct |
14 | Correct | 9 ms | 1288 KB | Output is correct |
15 | Correct | 12 ms | 1868 KB | Output is correct |
16 | Correct | 12 ms | 1868 KB | Output is correct |
17 | Correct | 15 ms | 2212 KB | Output is correct |
18 | Correct | 15 ms | 2228 KB | Output is correct |
19 | Correct | 15 ms | 2384 KB | Output is correct |
20 | Correct | 16 ms | 2332 KB | Output is correct |