제출 #800606

#제출 시각아이디문제언어결과실행 시간메모리
800606iskhakkutbilim콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define all(a) a.begin(), a.end()
/*

int press(string s){
	return 1;
}
*/

string guess_sequence(int N){
	string ans = "";
	if(press("A") == 1){
		ans.push_back('A');
	}else if(press("B") == 1){
		ans.push_back('B');
	}else if(press("X") == 1){
		ans.push_back('X');
	}else{
		ans.push_back('Y');
	}
	set<char> chars;
	chars.insert('A');
	chars.insert('B');
	chars.insert('X');
	chars.insert('Y');
	chars.erase(ans[0]);
	
	for(int i = 2;i <= N; i++){
		for(char ch : chars){
			if(press(ans+ch) == i){
				ans.push_back(ch);
				break;
			}
		}
	}
	if((int)ans.size() != N) assert(false);
	return ans;
}



/*

main(){
	int n; cin >> n;
	cout << guess_sequence(n);
	
	
	return 0;
}
*/

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:5: error: 'press' was not declared in this scope
   16 |  if(press("A") == 1){
      |     ^~~~~
combo.cpp:34:7: error: 'press' was not declared in this scope
   34 |    if(press(ans+ch) == i){
      |       ^~~~~