Submission #136424

# Submission time Handle Problem Language Result Execution time Memory
136424 2019-07-25T09:41:44 Z miguel Rice Hub (IOI11_ricehub) C++14
58 / 100
35 ms 1688 KB
#include<bits/stdc++.h>
#include<ricehub.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <int, pi>
#define vi vector <int>
const ll mod = 998244353;

int besthub(int n, int l, int x[], ll b){
    ll s[n+1];
    int ans=0;
    s[0]=1LL*x[0];
    s[n]=1000000000000000000;
    for(int i=1; i<n; i++) s[i]=s[i-1]+x[i];
    for(int i=0; i<n; i++){
        int l=0, r=n-i;
        while(r-l>1){
            int mid=(l+r)>>1;
            int start=i, e=i+mid;
            int xd=(start+e)/2;
            if((1LL*x[xd]*(2*xd-start-e)-1LL*s[xd-1]+1LL*s[start-1]+1LL*s[e]-1LL*s[xd])<=b) l=mid;
            else r=mid;
        }
        ans=max(ans, l);
    }
    return ans+1;
}

# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 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 376 KB Output is correct
6 Correct 2 ms 252 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 256 KB Output is correct
10 Correct 2 ms 504 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 256 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 404 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 3 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 4 ms 504 KB Output is correct
26 Correct 3 ms 376 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 564 KB Output is correct
2 Correct 7 ms 632 KB Output is correct
3 Correct 33 ms 1628 KB Output is correct
4 Correct 33 ms 1656 KB Output is correct
5 Correct 15 ms 1016 KB Output is correct
6 Correct 15 ms 1020 KB Output is correct
7 Correct 31 ms 1688 KB Output is correct
8 Correct 30 ms 1656 KB Output is correct
9 Correct 15 ms 1016 KB Output is correct
10 Correct 15 ms 1016 KB Output is correct
11 Correct 34 ms 1656 KB Output is correct
12 Correct 35 ms 1656 KB Output is correct
13 Correct 16 ms 1016 KB Output is correct
14 Correct 16 ms 1016 KB Output is correct
15 Correct 26 ms 1336 KB Output is correct
16 Correct 26 ms 1312 KB Output is correct
17 Correct 31 ms 1412 KB Output is correct
18 Correct 31 ms 1528 KB Output is correct
19 Correct 33 ms 1532 KB Output is correct
20 Correct 33 ms 1656 KB Output is correct