Submission #111646

# Submission time Handle Problem Language Result Execution time Memory
111646 2019-05-16T00:03:41 Z ly20 Rice Hub (IOI11_ricehub) C++14
0 / 100
5 ms 1024 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN=112345;
const long long MAXL=1123456789;
long long se[MAXN],sd[MAXN],v[MAXN];
int besthub(int r, int l, int x[], long long b)
{
	for(int i=0;i<r;i++)v[i]=x[i];
	se[0]=v[0];
	for(int i=1;i<r;i++)
	{
		se[i]=se[i-1]+v[i];
	}
	sd[r-1]=l-v[r-1];
	for(int i=r-2;i>=0;i--)sd[i]=sd[i+1]+v[i];
	int resp=0;
	int ini=0,fim=0;
	while(fim<r)
	{
		int m=(ini+fim)/2;
		long long cost=se[r]-se[m]-(r-m+1)*v[m]+sd[l]-sd[m]-(l-m+1)*(l-v[m]);
		if(cost<=b)
		{
			resp=max(resp,fim-ini+1);
			fim++;
		}
		else ini++;
	}
	return resp;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1024 KB Output isn't correct
2 Halted 0 ms 0 KB -