답안 #116776

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116776 2019-06-13T19:53:53 Z ioilolcom 사육제 (CEOI14_carnival) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
const int N=200;
int P[N],ans[N];
int cnt=0;
int ask(int P, int extra = -1) {
	if (extra <= P) {
		cout << P << " ";
		for (int i = 1; i <= P; i++) cout << i << " ";
		cout << endl;
		fflush(stdout);
	}
	else {
		cout << P + 1 << " ";
		for (int i = 1; i <= P; i++) cout << i << " ";
		cout << extra << endl;
		fflush(stdout);
	}
	int rtn;
	cin >> rtn;
	return rtn;
}
int main()
{
	int n; cin>>n;
	for(int i=1; i<=n; i++) {
		P[i]=query(i,0);
	}
	int nxt = 1;
	for (int i = 1; i <= n; i++) {
		int lo = 1, hi = i, mid;
		while (lo < hi) {
			mid = (lo + hi) / 2;
			if (P[mid] == query(mid, i)) hi = mid;
			else lo = mid + 1;
		}
		if (i == lo) ans[i] = nxt++;
		else ans[i] = ans[lo];
	}
	cout<<0<<" ";
	for(int i=1; i<=n; i++) {
		cout<<ans[i]<<" ";
	}
	cout<<endl;
	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:29:8: error: 'query' was not declared in this scope
   P[i]=query(i,0);
        ^~~~~
carnival.cpp:36:18: error: 'query' was not declared in this scope
    if (P[mid] == query(mid, i)) hi = mid;
                  ^~~~~