제출 #109533

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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define pb push_back
//int press (string s ){cout<<"query "<<s<<endl; 
//	int x ; cin>> x ; return x ; 
//}

string guess_sequence (int n){
		string buttons ,s;  
		if( press("A")==1 ) s.pb('A') , buttons = "BXY" ;
		else if( press("B")==1 ) s.pb('B') , buttons = "AXY" ;
		else if( press("X")==1 ) s.pb('X') , buttons = "ABY" ;
		else  s.pb('Y' ) , buttons = "ABX" ; 
		
		for(int i = 1 ; i < n ; i++ ){
			if( i == 1 ) {
				for( char b : buttons ){
					int ans = press ( s + b + buttons[0] ) ; 
					if( ans == i+1 ) s+=b ; 
					if( ans == i+2 ) s+=b , i ++ ; 
				}	 
			}else {
				int ans = press ( s + buttons[1] + buttons[0] ) ; 
				if( ans == i + 2 ) s += buttons[1] + buttons[0] , i++ ; 
				else if( ans == i + 1 ) s += buttons[1] ; 
				else s += buttons[2] ; 
			}
		}
		return s ; 
}

//int main(){int n ; cin>> n ; 
//	cout<<"answer is "<<guess_sequence(n)<<endl; 
//}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:7: error: 'press' was not declared in this scope
   17 |   if( press("A")==1 ) s.pb('A') , buttons = "BXY" ;
      |       ^~~~~
combo.cpp:25:16: error: 'press' was not declared in this scope
   25 |      int ans = press ( s + b + buttons[0] ) ;
      |                ^~~~~
combo.cpp:30:15: error: 'press' was not declared in this scope
   30 |     int ans = press ( s + buttons[1] + buttons[0] ) ;
      |               ^~~~~