# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
139161 |
2019-07-31T10:17:59 Z |
claudy |
Rice Hub (IOI11_ricehub) |
C++14 |
|
20 ms |
2556 KB |
# include "ricehub.h"
# include "bits/stdc++.h"
using namespace std;
long long a[1 << 17];
int besthub(int n, int useless, int v[], long long B)
{
# define int long long
int l = 1;
int r = n;
for(int i = 1;i <= n;i++)
{
a[i] = v[i - 1];
a[i] += a[i - 1];
}
while(l < r)
{
int len = (l + r + 1) / 2;
bool ok = 0;
for(int i = len;i <= n;i++)
{
int L = i - len + 1;
int R = i;
int mid = (L + R + 1) / 2;
int f = 0;
f += 1LL * (a[mid] - a[mid - 1]) * (mid - L) - a[mid - 1] + a[L - 1];
f += a[R] - a[mid] - 1LL * (a[mid] - a[mid - 1]) * (R - mid);
if(f <= B) ok = 1;
}
if(ok) l = len;
else r = len - 1;
}
return (int)l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
252 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
2 ms |
252 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
252 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
4 ms |
376 KB |
Output is correct |
28 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
372 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
1 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
3 ms |
376 KB |
Output is correct |
22 |
Correct |
3 ms |
376 KB |
Output is correct |
23 |
Correct |
3 ms |
376 KB |
Output is correct |
24 |
Correct |
3 ms |
376 KB |
Output is correct |
25 |
Correct |
3 ms |
376 KB |
Output is correct |
26 |
Correct |
3 ms |
380 KB |
Output is correct |
27 |
Correct |
3 ms |
376 KB |
Output is correct |
28 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
632 KB |
Output is correct |
2 |
Correct |
5 ms |
632 KB |
Output is correct |
3 |
Correct |
17 ms |
1500 KB |
Output is correct |
4 |
Correct |
17 ms |
1528 KB |
Output is correct |
5 |
Correct |
11 ms |
1272 KB |
Output is correct |
6 |
Correct |
11 ms |
1232 KB |
Output is correct |
7 |
Correct |
15 ms |
2296 KB |
Output is correct |
8 |
Correct |
16 ms |
2424 KB |
Output is correct |
9 |
Correct |
10 ms |
1144 KB |
Output is correct |
10 |
Correct |
10 ms |
1272 KB |
Output is correct |
11 |
Correct |
20 ms |
2556 KB |
Output is correct |
12 |
Correct |
20 ms |
2552 KB |
Output is correct |
13 |
Correct |
12 ms |
1272 KB |
Output is correct |
14 |
Correct |
12 ms |
1272 KB |
Output is correct |
15 |
Correct |
15 ms |
2084 KB |
Output is correct |
16 |
Correct |
15 ms |
2040 KB |
Output is correct |
17 |
Correct |
18 ms |
2296 KB |
Output is correct |
18 |
Correct |
18 ms |
2296 KB |
Output is correct |
19 |
Correct |
19 ms |
2424 KB |
Output is correct |
20 |
Correct |
19 ms |
2424 KB |
Output is correct |