# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
209729 |
2020-03-15T12:46:30 Z |
my99n |
Rice Hub (IOI11_ricehub) |
C++14 |
|
25 ms |
1532 KB |
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int n, int L, int x[], long long b){
long long s[100100]; s[0] = x[0];
for (int i = 1; i < n; i++) s[i] = 0;
for (int i = 1; i < n; i++) s[i] = x[i]+s[i-1];
int l = 0, r = 0, ans = 1;
while (r < n) {
int med = (l+r)/2;
long long low = (long long)x[med]*(med-l) - (s[med-1]-s[l-1]);
long long high = s[r]-s[med] - (long long)x[med]*(r-med);
if (low + high <= b) ans = max(ans, r++-l+1);
else l++;
}
return ans;
}
// int main () {
// int n, l, b;
// scanf("%d %d %d", &n, &l, &b);
// int x[n];
// for (int i = 0; i < n; i++) scanf("%d", &x[i]);
// printf("%d", besthub(n, l, x, b));
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
424 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
504 KB |
Output is correct |
14 |
Correct |
5 ms |
256 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
408 KB |
Output is correct |
17 |
Correct |
5 ms |
256 KB |
Output is correct |
18 |
Correct |
5 ms |
376 KB |
Output is correct |
19 |
Correct |
5 ms |
256 KB |
Output is correct |
20 |
Correct |
4 ms |
256 KB |
Output is correct |
21 |
Correct |
5 ms |
376 KB |
Output is correct |
22 |
Correct |
5 ms |
376 KB |
Output is correct |
23 |
Correct |
5 ms |
376 KB |
Output is correct |
24 |
Correct |
5 ms |
376 KB |
Output is correct |
25 |
Correct |
5 ms |
380 KB |
Output is correct |
26 |
Correct |
5 ms |
376 KB |
Output is correct |
27 |
Correct |
5 ms |
376 KB |
Output is correct |
28 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
4 ms |
380 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
5 ms |
380 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
380 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
5 ms |
380 KB |
Output is correct |
18 |
Correct |
5 ms |
376 KB |
Output is correct |
19 |
Correct |
5 ms |
376 KB |
Output is correct |
20 |
Correct |
5 ms |
376 KB |
Output is correct |
21 |
Correct |
5 ms |
376 KB |
Output is correct |
22 |
Correct |
5 ms |
376 KB |
Output is correct |
23 |
Correct |
5 ms |
376 KB |
Output is correct |
24 |
Correct |
5 ms |
376 KB |
Output is correct |
25 |
Correct |
6 ms |
504 KB |
Output is correct |
26 |
Correct |
5 ms |
376 KB |
Output is correct |
27 |
Correct |
5 ms |
376 KB |
Output is correct |
28 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
504 KB |
Output is correct |
2 |
Correct |
8 ms |
632 KB |
Output is correct |
3 |
Correct |
22 ms |
1532 KB |
Output is correct |
4 |
Correct |
22 ms |
1528 KB |
Output is correct |
5 |
Correct |
12 ms |
888 KB |
Output is correct |
6 |
Correct |
12 ms |
888 KB |
Output is correct |
7 |
Correct |
19 ms |
1528 KB |
Output is correct |
8 |
Correct |
20 ms |
1528 KB |
Output is correct |
9 |
Correct |
11 ms |
888 KB |
Output is correct |
10 |
Correct |
12 ms |
888 KB |
Output is correct |
11 |
Correct |
24 ms |
1528 KB |
Output is correct |
12 |
Correct |
25 ms |
1528 KB |
Output is correct |
13 |
Correct |
13 ms |
888 KB |
Output is correct |
14 |
Correct |
13 ms |
888 KB |
Output is correct |
15 |
Correct |
19 ms |
1144 KB |
Output is correct |
16 |
Correct |
18 ms |
1272 KB |
Output is correct |
17 |
Correct |
22 ms |
1400 KB |
Output is correct |
18 |
Correct |
22 ms |
1400 KB |
Output is correct |
19 |
Correct |
22 ms |
1400 KB |
Output is correct |
20 |
Correct |
23 ms |
1528 KB |
Output is correct |