답안 #61927

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
61927 2018-07-27T05:35:13 Z koosaga(#1793) popa (BOI18_popa) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef long long lint;

int go(int s, int e, int *l, int *r){
	if(s > e) return -1;
	if(s == e) return s;
	int lp = s, rp = e;
	while(true){
		if(query(lp, lp, s, e) == 1){
			l[lp] = go(s, lp - 1, l, r);
			r[lp] = go(lp + 1, e, l, r);
			return lp;
		}
		lp++;
		if(query(rp, rp, s, e) == 1){
			l[rp] = go(s, rp - 1, l, r);
			r[rp] = go(rp + 1, e, l, r);
			return rp;
		}
		rp--;
	}
	assert(0);
}

int solve(int N, int *l, int *r){
	for(int i=0; i<N; i++) l[i] = r[i] = -1;
	return go(0, N-1, l, r);
}

Compilation message

popa.cpp: In function 'int go(int, int, int*, int*)':
popa.cpp:11:6: error: 'query' was not declared in this scope
   if(query(lp, lp, s, e) == 1){
      ^~~~~
popa.cpp:17:6: error: 'query' was not declared in this scope
   if(query(rp, rp, s, e) == 1){
      ^~~~~