# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
362253 |
2021-02-02T10:56:49 Z |
WLZ |
Rice Hub (IOI11_ricehub) |
C++14 |
|
15 ms |
1644 KB |
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int r;
long long l, b;
vector<long long> x;
long long query(int a, int b) {
if (a > 0) return x[b] - x[a - 1];
return x[b];
}
bool check(int k) {
for (int i = k - 1; i < r; i++) {
long long cur = query(i - k / 2 + 1, i) - query(i - k + 1, i - (k + 1) / 2);
if (cur <= b) return true;
}
return false;
}
int besthub(int R, int L, int X[], long long B) {
r = R, l = L, b = B;
x = vector<long long>(X, X + r);
for (int i = 1; i < r; i++) x[i] += x[i - 1];
if (!check(2)) return 1;
int lo = 2, hi = r;
while (lo < hi) {
long long mid = (lo + hi + 1) / 2;
if (check(mid)) lo = mid;
else hi = mid - 1;
}
return lo;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
1 ms |
364 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
19 |
Correct |
1 ms |
364 KB |
Output is correct |
20 |
Correct |
1 ms |
364 KB |
Output is correct |
21 |
Correct |
1 ms |
364 KB |
Output is correct |
22 |
Correct |
1 ms |
364 KB |
Output is correct |
23 |
Correct |
1 ms |
364 KB |
Output is correct |
24 |
Correct |
1 ms |
364 KB |
Output is correct |
25 |
Correct |
1 ms |
364 KB |
Output is correct |
26 |
Correct |
1 ms |
364 KB |
Output is correct |
27 |
Correct |
1 ms |
364 KB |
Output is correct |
28 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
1 ms |
364 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
19 |
Correct |
1 ms |
364 KB |
Output is correct |
20 |
Correct |
1 ms |
364 KB |
Output is correct |
21 |
Correct |
1 ms |
372 KB |
Output is correct |
22 |
Correct |
1 ms |
364 KB |
Output is correct |
23 |
Correct |
1 ms |
364 KB |
Output is correct |
24 |
Correct |
1 ms |
364 KB |
Output is correct |
25 |
Correct |
1 ms |
364 KB |
Output is correct |
26 |
Correct |
1 ms |
364 KB |
Output is correct |
27 |
Correct |
1 ms |
364 KB |
Output is correct |
28 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
492 KB |
Output is correct |
2 |
Correct |
4 ms |
620 KB |
Output is correct |
3 |
Correct |
15 ms |
1536 KB |
Output is correct |
4 |
Correct |
15 ms |
1516 KB |
Output is correct |
5 |
Correct |
9 ms |
876 KB |
Output is correct |
6 |
Correct |
9 ms |
876 KB |
Output is correct |
7 |
Correct |
13 ms |
1644 KB |
Output is correct |
8 |
Correct |
13 ms |
1516 KB |
Output is correct |
9 |
Correct |
8 ms |
876 KB |
Output is correct |
10 |
Correct |
8 ms |
876 KB |
Output is correct |
11 |
Correct |
14 ms |
1516 KB |
Output is correct |
12 |
Correct |
15 ms |
1516 KB |
Output is correct |
13 |
Correct |
9 ms |
876 KB |
Output is correct |
14 |
Correct |
9 ms |
896 KB |
Output is correct |
15 |
Correct |
11 ms |
1132 KB |
Output is correct |
16 |
Correct |
11 ms |
1260 KB |
Output is correct |
17 |
Correct |
13 ms |
1388 KB |
Output is correct |
18 |
Correct |
13 ms |
1516 KB |
Output is correct |
19 |
Correct |
14 ms |
1388 KB |
Output is correct |
20 |
Correct |
14 ms |
1388 KB |
Output is correct |