Submission #136422

# Submission time Handle Problem Language Result Execution time Memory
136422 2019-07-25T09:38:32 Z miguel Rice Hub (IOI11_ricehub) C++14
58 / 100
34 ms 1656 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, end=i+mid;
            int xd=(start+end)/2;
            if((1LL*x[xd]*(2*xd-start-end)-1LL*s[xd-1]+1LL*s[start-1]+1LL*s[end]-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 376 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 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 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 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 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 364 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 256 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 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 3 ms 376 KB Output is correct
26 Correct 3 ms 440 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 504 KB Output is correct
2 Correct 7 ms 760 KB Output is correct
3 Correct 33 ms 1656 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 1016 KB Output is correct
7 Correct 30 ms 1656 KB Output is correct
8 Correct 30 ms 1656 KB Output is correct
9 Correct 15 ms 1144 KB Output is correct
10 Correct 15 ms 1016 KB Output is correct
11 Correct 34 ms 1656 KB Output is correct
12 Correct 34 ms 1584 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 1304 KB Output is correct
16 Correct 26 ms 1356 KB Output is correct
17 Correct 31 ms 1528 KB Output is correct
18 Correct 32 ms 1528 KB Output is correct
19 Correct 33 ms 1636 KB Output is correct
20 Correct 33 ms 1528 KB Output is correct