Submission #61308

# Submission time Handle Problem Language Result Execution time Memory
61308 2018-07-25T15:41:16 Z TuGSGeReL Rice Hub (IOI11_ricehub) C++14
0 / 100
10 ms 596 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]=X[0];
    	for(i=1;i<n;i++)c[i]=c[i-1]+X[i];
    	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 Incorrect 1 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -