제출 #109534

#제출 시각아이디문제언어결과실행 시간메모리
109534youssefbou62콤보 (IOI18_combo)C++14
0 / 100
2 ms220 KiB
#include  <bits/stdc++.h>
#include "combo.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; 
//}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…