# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170437 | 2019-12-25T09:55:49 Z | nafis_shifat | Rice Hub (IOI11_ricehub) | C++14 | 29 ms | 3448 KB |
#include "ricehub.h" #include<bits/stdc++.h> #define ll long long using namespace std; const int mxn=1e5+5; const ll inf=2e15+5; ll ar[mxn]; int besthub(int R, int L, int X[], long long B) { ll tot[mxn]; tot[0]=0; for(int i=1;i<=R;i++) { ar[i]=X[i-1]; tot[i]=tot[i-1]+ar[i]; } int ans=0; for(int i=1;i<=R;i++) { int lo=i; int hi=R; while(lo<=hi) { int mid=lo+hi>>1; int k=i+mid>>1; ll ts=(ar[k]*(k-i+1))-(tot[k]-tot[i-1]); ts+=(tot[mid]-tot[k])-ar[k]*(mid-k); if(ts<=B) { ans=max(ans,mid-i+1); lo=mid+1; } else { hi=mid-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 | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 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 | 380 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 | 404 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 | 348 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 | 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 | 376 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 | 3 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 | 380 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 | 380 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 | 408 KB | Output is correct |
21 | Correct | 3 ms | 504 KB | Output is correct |
22 | Correct | 10 ms | 504 KB | Output is correct |
23 | Correct | 3 ms | 504 KB | Output is correct |
24 | Correct | 3 ms | 504 KB | Output is correct |
25 | Correct | 3 ms | 504 KB | Output is correct |
26 | Correct | 3 ms | 504 KB | Output is correct |
27 | Correct | 3 ms | 504 KB | Output is correct |
28 | Correct | 3 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 888 KB | Output is correct |
2 | Correct | 6 ms | 888 KB | Output is correct |
3 | Correct | 26 ms | 3320 KB | Output is correct |
4 | Correct | 26 ms | 3320 KB | Output is correct |
5 | Correct | 12 ms | 1656 KB | Output is correct |
6 | Correct | 12 ms | 1660 KB | Output is correct |
7 | Correct | 23 ms | 3064 KB | Output is correct |
8 | Correct | 23 ms | 3064 KB | Output is correct |
9 | Correct | 12 ms | 1656 KB | Output is correct |
10 | Correct | 12 ms | 1528 KB | Output is correct |
11 | Correct | 27 ms | 3320 KB | Output is correct |
12 | Correct | 29 ms | 3448 KB | Output is correct |
13 | Correct | 13 ms | 1784 KB | Output is correct |
14 | Correct | 13 ms | 1656 KB | Output is correct |
15 | Correct | 22 ms | 2552 KB | Output is correct |
16 | Correct | 22 ms | 2552 KB | Output is correct |
17 | Correct | 24 ms | 3064 KB | Output is correct |
18 | Correct | 25 ms | 3008 KB | Output is correct |
19 | Correct | 26 ms | 3196 KB | Output is correct |
20 | Correct | 26 ms | 3192 KB | Output is correct |