답안 #54229

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
54229 2018-07-02T21:12:07 Z radoslav11 커다란 상품 (IOI17_prize) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "prize.h"
#include "Lgrader.cpp"

using namespace std;
template<class T, class T2> inline int chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline int chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

vector<int> memo[MAXN];
int Q = 0;

vector<int> query(int i) 
{
	if(memo[i].empty()) memo[i] = ask(i), Q++;
	if(Q == 10000) assert(false);
	return memo[i];
}

void rec(int l, int r)
{
	if(r < l) return;

	int mid = (l + r) >> 1; 

	if(query(l - 1) == query(mid))
		for(int i = l; i < mid; i++)
			memo[i] = query(mid);
	else
		rec(l, mid - 1);

	if(query(mid) == query(r + 1))
		for(int i = mid + 1; i <= r; i++)
			memo[i] = query(mid);
	else
		rec(mid + 1, r);

}

int find_best(int n) 
{
	/*int i = 0;
	while(i < n)
	{
		auto curr = query(i);
		if(curr[0] == 0 && curr[1] == 0)
			return i;

		int low = i, high = n - 1, mid, ret;
		for(int l = 0; low + (1 << l) < n; l++)
		{
			if(curr != query(low + (1 << l))) 
			{
				high = low + (1 << l);
				break;
			}
			
			low += (1 << l);
		}

		while(low <= high)
		{
			mid = (low + high) >> 1;
			if(curr == query(mid))
				low = mid + 1, ret = mid;
			else
				high = mid - 1;
		}

		i = ret + 1;
	}*/

	rec(1, n - 2);

	for(int i = 0; i < n; i++)
		if(query(i)[0] + query(i)[1] == 0)
			return i;

	return -1;
}

Compilation message

prize.cpp:3:10: fatal error: Lgrader.cpp: No such file or directory
 #include "Lgrader.cpp"
          ^~~~~~~~~~~~~
compilation terminated.