제출 #109618

#제출 시각아이디문제언어결과실행 시간메모리
109618youssefbou62Combo (IOI18_combo)C++14
0 / 100
1 ms244 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

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" ; 
		
		while ( (int)s.length() != n ){
		string s2 = s ; 
		for(int i = 0 ; i < 4*n-1 ; i++ ) s2.pb(buttons[0]); 
		int ans = press ( s2 ) ; 
		while ( ans > (int)s.length() ) s.pb(buttons[0]) ; 
		 s2=s ; 
		for(int i = 0 ; i < 4*n-1 ; i++ ) s2.pb(buttons[1]); 
		 ans = press ( s2 ) ; 
		while ( ans > (int)s.length() ) s.pb(buttons[1]) ;
		 
		 s2=s ; 
		for(int i = 0 ; i < 4*n-1 ; i++ ) s2.pb(buttons[2]); 
		 ans = press ( s2 ) ; 
		while ( ans > (int)s.length() ) s.pb(buttons[2]) ;  
		}
		
		assert( (int)s.length() == n) ; 
		return s ; 
}

#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…