제출 #600481

#제출 시각아이디문제언어결과실행 시간메모리
600481angelo_torres콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
// #include "combo.h"

using namespace std;

// int press(string mn){
// 	int tc;
// 	cout << mn << endl;
// 	cin >> tc;
// 	return tc;
// }

int n;
vector<string> v = {"A","B","X","Y"};


string guess_sequence(int N){
	n = N;
	// cin >> n;
	string s = "";
	if(press("AB")){
		if(press("A")){
			s = "A";
			v.erase(v.begin());
		}
		else{
			s = "B";
			v.erase(v.begin()+1);
		}
	}
	else{
		if(press("X")){
			s = "X";
			v.erase(v.begin()+2);
		}
		else{
			s = "Y";
			v.erase(v.begin()+3);
		}
	}
	for(int i = 1; i <= n-2; ++i){
		int csi = i;
		string pos = "";
		pos += (s+v[0]);
		pos += (s+v[1]+v[0]);
		pos += (s+v[1]+v[1]);
		pos += (s+v[1]+v[2]);
		int val = press(pos);
		if(val == csi){
			s += v[2];
		}
		if(val == csi+1){
			s += v[0];
		}
		if(val == csi+2){
			s += v[1];
		}
	}
	if(press(s+v[0]+s+v[1]) == n){
		if(press(s+v[0]) == n){
			s += v[0];
		}
		else{
			s += v[1];
		}
	}
	else{
		s += v[2];
	}
	return s;
}

// int main(){
// 	cout << guess_sequence(0) << endl;
// 	return 0;
// }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:5: error: 'press' was not declared in this scope
   21 |  if(press("AB")){
      |     ^~~~~
combo.cpp:48:13: error: 'press' was not declared in this scope
   48 |   int val = press(pos);
      |             ^~~~~
combo.cpp:59:5: error: 'press' was not declared in this scope
   59 |  if(press(s+v[0]+s+v[1]) == n){
      |     ^~~~~