# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
522295 | 2022-02-04T14:17:25 Z | new_acc | Rice Hub (IOI11_ricehub) | C++14 | 16 ms | 2500 KB |
#include<bits/stdc++.h> #define fi first #define se second #define rep(a, b) for(int a = 0; a < (int)(b); a++) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; const int N=1e5+10; ll sp[N]; bool check(int i,int j,ll b){ int il=(j-i+1)/2; ll xd=sp[i+il-1]-(i==0?0:sp[i-1]); ll xd2=sp[j]-(j-il<0?0:sp[j-il]); return (xd2-xd)<=b; } int bs(int pocz,int kon,ll b){ int p=pocz; int sr,res; while(pocz<=kon){ sr=(pocz+kon)/2; if(check(p,sr,b)) res=sr,pocz=sr+1; else kon=sr-1; } return res; } int besthub(int n,int l,int t[],ll b){ int ans=0; sp[0]=t[0]; for(int i=1;i<n;i++) sp[i]+=sp[i-1]+t[i]; rep(i,n) ans=max(ans,bs(i,n-1,b)-i+1); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 296 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 304 KB | Output is correct |
11 | Correct | 1 ms | 296 KB | Output is correct |
12 | Correct | 1 ms | 300 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 300 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 0 ms | 204 KB | Output is correct |
18 | Correct | 0 ms | 204 KB | Output is correct |
19 | Correct | 0 ms | 204 KB | Output is correct |
20 | Correct | 0 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 296 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 1 ms | 204 KB | Output is correct |
24 | Correct | 0 ms | 300 KB | Output is correct |
25 | Correct | 0 ms | 204 KB | Output is correct |
26 | Correct | 1 ms | 204 KB | Output is correct |
27 | Correct | 1 ms | 204 KB | Output is correct |
28 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 292 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 304 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 0 ms | 304 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 300 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 308 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 0 ms | 308 KB | Output is correct |
21 | Correct | 1 ms | 332 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 1 ms | 300 KB | Output is correct |
24 | Correct | 1 ms | 344 KB | Output is correct |
25 | Correct | 1 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
27 | Correct | 1 ms | 336 KB | Output is correct |
28 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 580 KB | Output is correct |
2 | Correct | 3 ms | 560 KB | Output is correct |
3 | Correct | 15 ms | 2500 KB | Output is correct |
4 | Correct | 16 ms | 2492 KB | Output is correct |
5 | Correct | 7 ms | 1204 KB | Output is correct |
6 | Correct | 7 ms | 1228 KB | Output is correct |
7 | Correct | 14 ms | 2116 KB | Output is correct |
8 | Correct | 14 ms | 2148 KB | Output is correct |
9 | Correct | 7 ms | 1164 KB | Output is correct |
10 | Correct | 7 ms | 1100 KB | Output is correct |
11 | Correct | 16 ms | 2500 KB | Output is correct |
12 | Correct | 15 ms | 2480 KB | Output is correct |
13 | Correct | 7 ms | 1228 KB | Output is correct |
14 | Correct | 7 ms | 1228 KB | Output is correct |
15 | Correct | 11 ms | 1876 KB | Output is correct |
16 | Correct | 12 ms | 1828 KB | Output is correct |
17 | Correct | 13 ms | 2248 KB | Output is correct |
18 | Correct | 13 ms | 2232 KB | Output is correct |
19 | Correct | 14 ms | 2372 KB | Output is correct |
20 | Correct | 14 ms | 2368 KB | Output is correct |