Submission #158062

# Submission time Handle Problem Language Result Execution time Memory
158062 2019-10-14T15:07:46 Z lukameladze Rice Hub (IOI11_ricehub) C++14
0 / 100
5 ms 632 KB
# include<bits/stdc++.h>
using namespace std;
long long r,l,b,n,pos[100005],w,sum[100005],mid,shua,ans,sn,sm,ri;
long long besthub(int r,int l, int x[],long long b) 
{
	cin>>r>>l>>b;
	for (long long i=1; i<=r; i++)
	{
		cin>>pos[i];
		w+=pos[i];
		sum[i]=w;
	}
	l=1;
	ri=r;
	while (l<=ri)
	{
		mid=(l+ri+1)/2;
		for (long long i=1; i<=r-mid+1; i++)
		{
		//	cout<<i<<" "<<l<<" "<<pos[l]<<" "<<ri<<" "<<pos[ri]<<" "<<mid<<" "<<pos[mid]<<endl;
			shua=(i+mid)/2;
			sn=sum[shua-1]-sum[i-1];
			sm=sum[i+mid-1]-sum[shua];
			if ((pos[shua]*(shua-i)-sn)+sm-(pos[shua]*(i+mid-1-shua))<=b)
			{
				ans=mid;
				l=mid+1;
			}
			else
			{
				ri=mid-1;
			}
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -