# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
978437 | 2024-05-09T08:26:04 Z | Newtonabc | Rice Hub (IOI11_ricehub) | C++14 | 18 ms | 4464 KB |
#include "ricehub.h" #include<bits/stdc++.h> using namespace std; int besthub(int R, int L, int X[], long long B) { const int N=1e5+10; long long qs[N]; double tX[N]; int mx=0; qs[0]=X[0]; tX[0]=X[0]; for(int i=1;i<R;i++) qs[i]=X[i]+qs[i-1],tX[i]=X[i]; for(int i=0;i<R;i++){ int l=i,r=R-1; while(l<r){ int mid=(l+r+1)/2; long long sum=qs[mid],bg=0; if(i>0) sum-=qs[i-1]; double mean=(double)sum/(double)(mid-i+1); int ind=(i+mid)/2; bg=(qs[mid]-qs[ind]-((long long)X[ind]*(long long)(mid-ind)))+((long long)X[ind]*(long long)(ind-i)); if(ind-1>=0) bg-=qs[ind-1]; if(i>0) bg+=qs[i-1]; if(bg<=B) l=mid; else r=mid-1; } mx=max(mx,l-i+1); } return mx; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1116 KB | Output is correct |
2 | Correct | 1 ms | 1116 KB | Output is correct |
3 | Correct | 1 ms | 1116 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 1 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1116 KB | Output is correct |
2 | Correct | 1 ms | 1116 KB | Output is correct |
3 | Correct | 1 ms | 1116 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 1 ms | 1116 KB | Output is correct |
6 | Correct | 1 ms | 1116 KB | Output is correct |
7 | Correct | 1 ms | 1116 KB | Output is correct |
8 | Correct | 1 ms | 1116 KB | Output is correct |
9 | Correct | 1 ms | 1144 KB | Output is correct |
10 | Correct | 1 ms | 1116 KB | Output is correct |
11 | Correct | 1 ms | 1116 KB | Output is correct |
12 | Correct | 1 ms | 1116 KB | Output is correct |
13 | Correct | 1 ms | 1116 KB | Output is correct |
14 | Correct | 1 ms | 1116 KB | Output is correct |
15 | Correct | 1 ms | 1116 KB | Output is correct |
16 | Correct | 1 ms | 1116 KB | Output is correct |
17 | Correct | 1 ms | 1116 KB | Output is correct |
18 | Correct | 1 ms | 1116 KB | Output is correct |
19 | Correct | 1 ms | 1116 KB | Output is correct |
20 | Correct | 1 ms | 1116 KB | Output is correct |
21 | Correct | 1 ms | 1116 KB | Output is correct |
22 | Correct | 1 ms | 1116 KB | Output is correct |
23 | Correct | 1 ms | 1116 KB | Output is correct |
24 | Correct | 1 ms | 1112 KB | Output is correct |
25 | Correct | 1 ms | 1116 KB | Output is correct |
26 | Correct | 1 ms | 1116 KB | Output is correct |
27 | Correct | 1 ms | 1116 KB | Output is correct |
28 | Correct | 1 ms | 1212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1116 KB | Output is correct |
2 | Correct | 1 ms | 1116 KB | Output is correct |
3 | Correct | 1 ms | 1116 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 1 ms | 1116 KB | Output is correct |
6 | Correct | 1 ms | 1116 KB | Output is correct |
7 | Correct | 1 ms | 1116 KB | Output is correct |
8 | Correct | 1 ms | 1116 KB | Output is correct |
9 | Correct | 1 ms | 1116 KB | Output is correct |
10 | Correct | 1 ms | 1116 KB | Output is correct |
11 | Correct | 1 ms | 1116 KB | Output is correct |
12 | Correct | 1 ms | 1116 KB | Output is correct |
13 | Correct | 1 ms | 1116 KB | Output is correct |
14 | Correct | 1 ms | 1112 KB | Output is correct |
15 | Correct | 1 ms | 1116 KB | Output is correct |
16 | Correct | 1 ms | 1116 KB | Output is correct |
17 | Correct | 1 ms | 1112 KB | Output is correct |
18 | Correct | 1 ms | 1112 KB | Output is correct |
19 | Correct | 1 ms | 1116 KB | Output is correct |
20 | Correct | 1 ms | 1116 KB | Output is correct |
21 | Correct | 1 ms | 1316 KB | Output is correct |
22 | Correct | 1 ms | 1116 KB | Output is correct |
23 | Correct | 1 ms | 1116 KB | Output is correct |
24 | Correct | 1 ms | 1116 KB | Output is correct |
25 | Correct | 2 ms | 1116 KB | Output is correct |
26 | Correct | 1 ms | 1116 KB | Output is correct |
27 | Correct | 1 ms | 1112 KB | Output is correct |
28 | Correct | 1 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1116 KB | Output is correct |
2 | Correct | 3 ms | 1116 KB | Output is correct |
3 | Correct | 18 ms | 3424 KB | Output is correct |
4 | Correct | 13 ms | 3420 KB | Output is correct |
5 | Correct | 7 ms | 3420 KB | Output is correct |
6 | Correct | 9 ms | 3420 KB | Output is correct |
7 | Correct | 11 ms | 3420 KB | Output is correct |
8 | Correct | 12 ms | 3420 KB | Output is correct |
9 | Correct | 7 ms | 3328 KB | Output is correct |
10 | Correct | 7 ms | 3420 KB | Output is correct |
11 | Correct | 12 ms | 3420 KB | Output is correct |
12 | Correct | 13 ms | 3572 KB | Output is correct |
13 | Correct | 7 ms | 3420 KB | Output is correct |
14 | Correct | 7 ms | 3420 KB | Output is correct |
15 | Correct | 10 ms | 3420 KB | Output is correct |
16 | Correct | 9 ms | 3420 KB | Output is correct |
17 | Correct | 12 ms | 4188 KB | Output is correct |
18 | Correct | 12 ms | 4188 KB | Output is correct |
19 | Correct | 13 ms | 4464 KB | Output is correct |
20 | Correct | 12 ms | 4440 KB | Output is correct |