Submission #136611

# Submission time Handle Problem Language Result Execution time Memory
136611 2019-07-25T18:38:10 Z miguel Rice Hub (IOI11_ricehub) C++14
100 / 100
34 ms 1528 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(start==0){
             	if((1LL*x[xd]*(2*xd-start-e)-1LL*s[xd-1]+1LL*s[e]-1LL*s[xd])<=b) l=mid;
            	else r=mid;
            }
            else 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 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
# 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 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 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 380 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 380 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 3 ms 256 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
# 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 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 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 256 KB Output is correct
11 Correct 2 ms 256 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 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 348 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 376 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 504 KB Output is correct
2 Correct 7 ms 632 KB Output is correct
3 Correct 33 ms 1528 KB Output is correct
4 Correct 32 ms 1528 KB Output is correct
5 Correct 15 ms 892 KB Output is correct
6 Correct 15 ms 888 KB Output is correct
7 Correct 30 ms 1528 KB Output is correct
8 Correct 30 ms 1528 KB Output is correct
9 Correct 15 ms 888 KB Output is correct
10 Correct 14 ms 888 KB Output is correct
11 Correct 34 ms 1528 KB Output is correct
12 Correct 34 ms 1528 KB Output is correct
13 Correct 16 ms 888 KB Output is correct
14 Correct 16 ms 888 KB Output is correct
15 Correct 26 ms 1232 KB Output is correct
16 Correct 25 ms 1144 KB Output is correct
17 Correct 30 ms 1400 KB Output is correct
18 Correct 31 ms 1404 KB Output is correct
19 Correct 32 ms 1400 KB Output is correct
20 Correct 32 ms 1508 KB Output is correct