Submission #61311

# Submission time Handle Problem Language Result Execution time Memory
61311 2018-07-25T15:42:48 Z TuGSGeReL Rice Hub (IOI11_ricehub) C++14
100 / 100
43 ms 1900 KB
    #include "ricehub.h"
    #include<bits/stdc++.h>
    #define ll long long
    #define mp make_pair
    #define pub push_back
    #define pob pop_back
    using namespace std;
    ll i,ans,c[111111];
    bool can(ll k, ll kk, int X[],ll B){
    	ll md=(k+kk)/2,cst;
    	cst=(md-k-kk+md)*X[md]-c[md]+c[k]+c[kk+1]-c[md+1];
    	if(cst<=B) return 1;
    	else return 0;
    }
    int besthub(int n, int L, int X[], long long B) {
    	c[0]=0;
    	for(i=1;i<=n;i++)c[i]=c[i-1]+X[i-1];
    	for(i=0;i<n;i++){
    		ll x=i,y=n;
    		while(x+1!=y){
    			ll mid=(x+y)/2;
    			if(can(i,mid,X,B))x=mid;
    			else y=mid;
    		}
			ans=max(ans,y-i);
		}
    	return ans;
    }
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 3 ms 664 KB Output is correct
4 Correct 2 ms 664 KB Output is correct
5 Correct 3 ms 664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 664 KB Output is correct
2 Correct 2 ms 664 KB Output is correct
3 Correct 2 ms 664 KB Output is correct
4 Correct 4 ms 664 KB Output is correct
5 Correct 2 ms 664 KB Output is correct
6 Correct 3 ms 664 KB Output is correct
7 Correct 4 ms 664 KB Output is correct
8 Correct 3 ms 664 KB Output is correct
9 Correct 3 ms 664 KB Output is correct
10 Correct 3 ms 664 KB Output is correct
11 Correct 2 ms 664 KB Output is correct
12 Correct 3 ms 664 KB Output is correct
13 Correct 3 ms 664 KB Output is correct
14 Correct 2 ms 664 KB Output is correct
15 Correct 3 ms 664 KB Output is correct
16 Correct 3 ms 740 KB Output is correct
17 Correct 2 ms 740 KB Output is correct
18 Correct 3 ms 740 KB Output is correct
19 Correct 3 ms 740 KB Output is correct
20 Correct 2 ms 740 KB Output is correct
21 Correct 3 ms 740 KB Output is correct
22 Correct 2 ms 740 KB Output is correct
23 Correct 3 ms 740 KB Output is correct
24 Correct 3 ms 740 KB Output is correct
25 Correct 4 ms 740 KB Output is correct
26 Correct 4 ms 740 KB Output is correct
27 Correct 3 ms 740 KB Output is correct
28 Correct 3 ms 740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 740 KB Output is correct
2 Correct 2 ms 740 KB Output is correct
3 Correct 3 ms 740 KB Output is correct
4 Correct 3 ms 740 KB Output is correct
5 Correct 3 ms 740 KB Output is correct
6 Correct 2 ms 740 KB Output is correct
7 Correct 2 ms 740 KB Output is correct
8 Correct 3 ms 740 KB Output is correct
9 Correct 3 ms 740 KB Output is correct
10 Correct 2 ms 740 KB Output is correct
11 Correct 2 ms 740 KB Output is correct
12 Correct 3 ms 740 KB Output is correct
13 Correct 2 ms 740 KB Output is correct
14 Correct 2 ms 740 KB Output is correct
15 Correct 3 ms 740 KB Output is correct
16 Correct 2 ms 740 KB Output is correct
17 Correct 3 ms 740 KB Output is correct
18 Correct 2 ms 740 KB Output is correct
19 Correct 4 ms 740 KB Output is correct
20 Correct 3 ms 740 KB Output is correct
21 Correct 4 ms 740 KB Output is correct
22 Correct 4 ms 740 KB Output is correct
23 Correct 5 ms 740 KB Output is correct
24 Correct 5 ms 740 KB Output is correct
25 Correct 4 ms 740 KB Output is correct
26 Correct 4 ms 740 KB Output is correct
27 Correct 4 ms 740 KB Output is correct
28 Correct 4 ms 740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 752 KB Output is correct
2 Correct 8 ms 752 KB Output is correct
3 Correct 32 ms 1772 KB Output is correct
4 Correct 29 ms 1772 KB Output is correct
5 Correct 14 ms 1772 KB Output is correct
6 Correct 18 ms 1772 KB Output is correct
7 Correct 28 ms 1772 KB Output is correct
8 Correct 31 ms 1772 KB Output is correct
9 Correct 15 ms 1772 KB Output is correct
10 Correct 16 ms 1772 KB Output is correct
11 Correct 42 ms 1772 KB Output is correct
12 Correct 43 ms 1900 KB Output is correct
13 Correct 15 ms 1900 KB Output is correct
14 Correct 15 ms 1900 KB Output is correct
15 Correct 24 ms 1900 KB Output is correct
16 Correct 22 ms 1900 KB Output is correct
17 Correct 29 ms 1900 KB Output is correct
18 Correct 34 ms 1900 KB Output is correct
19 Correct 29 ms 1900 KB Output is correct
20 Correct 33 ms 1900 KB Output is correct