답안 #1084331

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084331 2024-09-05T22:21:11 Z 4QT0R 사육제 (CEOI14_carnival) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int odp[152];
int dtf[152];
int comm(int l, int r, int ind){
	if (l==r)return l;
	int md=(l+r)/2;

	int query;
	cout << md-l+2 << ' ';
	for (int j = l; j<=md; j++)cout << j << ' ';
	cout << ind << endl;
	cin >> query;

	if (query==(dif[md]-dif[l-1]))return comm(l,md,ind);
	else return comm(md+1,r,ind);
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	odp[1]=1;
	dif[1]=1;
	int spoj=1;
	for (int i = 2; i<=n; i++){
		cout << i << ' ';
		for (int j = 1; j<=i; j++)cout << j << ' ';
		cout << endl;
		cin >> dif[i];
		if (dif[i]>spoj){
			odp[i]=++spoj;
			continue;
		}
		odp[i]=odp[comm(1,i-1,i)];
	}
	cout << "0 ";
	for (int i = 1; i<=n; i++)cout << odp[i] << ' ';
	cout << '\n';
	return 0;
}

Compilation message

carnival.cpp: In function 'int comm(int, int, int)':
carnival.cpp:16:14: error: 'dif' was not declared in this scope; did you mean 'dtf'?
   16 |  if (query==(dif[md]-dif[l-1]))return comm(l,md,ind);
      |              ^~~
      |              dtf
carnival.cpp: In function 'int main()':
carnival.cpp:27:2: error: 'dif' was not declared in this scope; did you mean 'dtf'?
   27 |  dif[1]=1;
      |  ^~~
      |  dtf
carnival.cpp: In function 'int comm(int, int, int)':
carnival.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^