Submission #139160

# Submission time Handle Problem Language Result Execution time Memory
139160 2019-07-31T10:17:41 Z claudy Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
# include "ricehub.h"
# include "bits/stdc++.h"
using namespace std;
 
ll a[1 << 17];
 
int besthub(int n, int useless, int v[], long long B)
{
# define int long long
	int l = 1;
	int r = n;
	for(int i = 1;i <= n;i++)
	{
		a[i] = v[i - 1];
		a[i] += a[i - 1];
	}
	while(l < r)
	{
		int len = (l + r + 1) / 2;
		bool ok = 0;
		for(int i = len;i <= n;i++)
		{
			int L = i - len + 1;
			int R = i;
			int mid = (L + R + 1) / 2;
			int f = 0;
			f += 1LL * (a[mid] - a[mid - 1]) * (mid - L) - a[mid - 1] + a[L - 1];
			f += a[R] - a[mid] - 1LL * (a[mid] - a[mid - 1]) * (R - mid);
			if(f <= B) ok = 1;
		}
		if(ok) l = len;
		else r = len - 1;
	}
	return (int)l;
}

Compilation message

ricehub.cpp:5:1: error: 'll' does not name a type
 ll a[1 << 17];
 ^~
ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:14:3: error: 'a' was not declared in this scope
   a[i] = v[i - 1];
   ^
ricehub.cpp:27:16: error: 'a' was not declared in this scope
    f += 1LL * (a[mid] - a[mid - 1]) * (mid - L) - a[mid - 1] + a[L - 1];
                ^