제출 #794466

#제출 시각아이디문제언어결과실행 시간메모리
794466Sohsoh84커다란 상품 (IOI17_prize)C++17
컴파일 에러
0 ms0 KiB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;

const int MAX = 500; // CHANGE
const int SQ = 256;
const int MAXN = 2e5 + 10;

#define debug(x)		cerr << #x << ": " << x << endl;
#define sep			' '

int n;
vector<int> res[MAXN];
bool B[MAXN];

inline vector<int> assk(int ind) {
	if (B[ind]) return res[ind];
	B[ind] = true;
	return res[ind] = ask(ind);
}

inline int sum(int ind) {
	vector<int> res = assk(ind);
	return res[0] + res[1];
}

inline int find_cheapest() {
	int best_val = 0;
	for (int i = 0; i < min(n, MAX); i++) {
		int val = sum(i);
		if (val > best_val)
			best_val = val;

	}

	return {best_val;
}


int find_best(int n_) {
	n = n_;
	int lim = find_cheapest();
	
	int lc = 0;
	int ind = 0;
	while (ind < n) {
		int tr = min(ind + SQ - 1, n - 1);
		vector<int> res = assk(tr);
		if (res[0] + res[1] == lim && lc == res[0]) {
			ind = ind + SQ;	
			continue;
		}

		int l = ind, r = min(ind + SQ - 1, n - 1);
		while (l < r) {
			int mid = (l + r) >> 1;
			vector<int> res = assk(mid);	
			if (res[0] + res[1] < lim || res[0] > lc) r = mid;
			else l = mid + 1;
		}

		if (sum(l) == 0) return l;
		ind = l + 1;
		lc++;
	}

	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

prize.cpp: In function 'int find_cheapest()':
prize.cpp:37:18: error: expected '}' before ';' token
   37 |  return {best_val;
      |         ~        ^