Submission #961798

# Submission time Handle Problem Language Result Execution time Memory
961798 2024-04-12T13:06:07 Z hirayuu_oj Rice Hub (IOI11_ricehub) C++17
100 / 100
12 ms 5292 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) x.begin(),x.end()
using ll=long long;
const ll INF=1LL<<60;

int besthub(int R, int L, int X[], long long B){
    vector<ll> cum(R+1,0);
    vector<ll> x(R);
    rep(i,R){
        x[i]=X[i];
        cum[i+1]=cum[i]+x[i];
    }
    ll ok=1,ng=R+1;
    while(ng-ok>1){
        ll mid=(ok+ng)>>1;
        ll half=mid>>1;
        bool can=0;
        rep(i,R-mid+1){
            ll lf=cum[i+half]-cum[i];
            ll ri=cum[i+mid]-cum[i+half];
            ll rs=0;
            if(mid&1)rs-=x[i+half];
            if(rs+ri-lf<=B){
                can=1;
            }
        }
        if(can)ok=mid;
        else ng=mid;
    }
    return ok;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 448 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 600 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 444 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 440 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 420 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 0 ms 448 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 464 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 860 KB Output is correct
2 Correct 2 ms 968 KB Output is correct
3 Correct 9 ms 5212 KB Output is correct
4 Correct 11 ms 5212 KB Output is correct
5 Correct 5 ms 3672 KB Output is correct
6 Correct 5 ms 3676 KB Output is correct
7 Correct 8 ms 4772 KB Output is correct
8 Correct 9 ms 4956 KB Output is correct
9 Correct 5 ms 3676 KB Output is correct
10 Correct 7 ms 3676 KB Output is correct
11 Correct 9 ms 5292 KB Output is correct
12 Correct 10 ms 5208 KB Output is correct
13 Correct 5 ms 3676 KB Output is correct
14 Correct 5 ms 3824 KB Output is correct
15 Correct 7 ms 4444 KB Output is correct
16 Correct 7 ms 4444 KB Output is correct
17 Correct 8 ms 4976 KB Output is correct
18 Correct 12 ms 5212 KB Output is correct
19 Correct 9 ms 4960 KB Output is correct
20 Correct 9 ms 4956 KB Output is correct