# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96299 | 2019-02-08T09:09:50 Z | figter001 | Rice Hub (IOI11_ricehub) | C++14 | 51 ms | 2556 KB |
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxr = 1e5+50; ll sum[maxr]; int besthub(int r, int L, int x[], long long B){ int ans = 0; sum[0] = x[0]; for(int i=1;i<r;i++) sum[i] = sum[i-1] + x[i]; for(int i=0;i<r;i++){ int md,lo=i,hi=r-1,best; ll rem = 0; if(i)rem = sum[i-1]; while(lo <= hi){ md = (lo+hi)/2; int at = (i+md)/2; ll lf = x[at] * (at - i + 1) - (sum[at] - rem); ll rem2 = 0; if(at)rem2 = sum[at-1]; ll ri = (sum[md] - rem2) - x[at] * (md-at+1); if(ri + lf <= B){ lo = md+1; best = md; }else hi = md-1; } ans = max(ans,best - i + 1); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 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 | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 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 | 376 KB | Output is correct |
7 | Correct | 2 ms | 296 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 | 256 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 | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 252 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 | 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 | 256 KB | Output is correct |
26 | Correct | 2 ms | 376 KB | Output is correct |
27 | Correct | 2 ms | 376 KB | Output is correct |
28 | 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 | 376 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 | 376 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 | 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 | 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 | 376 KB | Output is correct |
18 | Correct | 2 ms | 380 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 | 3 ms | 376 KB | Output is correct |
24 | Correct | 2 ms | 376 KB | Output is correct |
25 | Correct | 3 ms | 376 KB | Output is correct |
26 | Correct | 3 ms | 376 KB | Output is correct |
27 | Correct | 3 ms | 376 KB | Output is correct |
28 | Correct | 4 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 760 KB | Output is correct |
2 | Correct | 5 ms | 632 KB | Output is correct |
3 | Correct | 25 ms | 2552 KB | Output is correct |
4 | Correct | 22 ms | 2552 KB | Output is correct |
5 | Correct | 10 ms | 1272 KB | Output is correct |
6 | Correct | 11 ms | 1272 KB | Output is correct |
7 | Correct | 21 ms | 2296 KB | Output is correct |
8 | Correct | 21 ms | 2296 KB | Output is correct |
9 | Correct | 11 ms | 1188 KB | Output is correct |
10 | Correct | 12 ms | 1272 KB | Output is correct |
11 | Correct | 25 ms | 2556 KB | Output is correct |
12 | Correct | 27 ms | 2552 KB | Output is correct |
13 | Correct | 11 ms | 1272 KB | Output is correct |
14 | Correct | 12 ms | 1272 KB | Output is correct |
15 | Correct | 19 ms | 2012 KB | Output is correct |
16 | Correct | 19 ms | 1912 KB | Output is correct |
17 | Correct | 22 ms | 2396 KB | Output is correct |
18 | Correct | 22 ms | 2296 KB | Output is correct |
19 | Correct | 23 ms | 2424 KB | Output is correct |
20 | Correct | 51 ms | 2424 KB | Output is correct |