제출 #397693

#제출 시각아이디문제언어결과실행 시간메모리
397693drekavac콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <vector>
using namespace std;

vector<char> c;

string guess_sequence(int n){
	//pogodi prvi karakter
	char f;
	if(press("AB")){
		if(press("A")) f = 'A';
		else f = 'B';
	}
	else if(press("X")) f = 'X';
	else f = 'Y';
	
	if('A'!=f) c.push_back('A');
	if('B'!=f) c.push_back('B');
	if('X'!=f) c.push_back('X');
	if('Y'!=f) c.push_back('Y');

	string p = "";
	p += f;
	
	for(int i=1; i<n-1; i++){
		string pr = "";
		pr += p + c[0] + c[0] + p + c[0] + c[1] + p + c[0] + c[2] + p + c[1];
		
		if(press(pr) == p.length()) p += c[2];
		else if(press(pr) == p.length()+1) p += c[1];
		else p += c[0];  
	}
	
	if(press(p+c[0]) == n) p+=c[0];
	else if(press(p+c[1]) == n) p+=c[1];
	else p+=c[2];
	
	return p;
}








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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:5: error: 'press' was not declared in this scope
   10 |  if(press("AB")){
      |     ^~~~~
combo.cpp:29:6: error: 'press' was not declared in this scope
   29 |   if(press(pr) == p.length()) p += c[2];
      |      ^~~~~
combo.cpp:34:5: error: 'press' was not declared in this scope
   34 |  if(press(p+c[0]) == n) p+=c[0];
      |     ^~~~~