답안 #139160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
139160 2019-07-31T10:17:41 Z claudy 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
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];
                ^