제출 #109651

#제출 시각아이디문제언어결과실행 시간메모리
109651youssefbou62콤보 (IOI18_combo)C++14
97 / 100
51 ms508 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 ; int ans ; if( (int) s.length() == n-1 ) { s2 = s + buttons[0] ; if( press ( s2 ) == (int)s.length() + 1 ){ s.pb(buttons[0]) ; break ; } s2 = s + buttons[1] ; if( press ( s2 ) == (int)s.length() + 1 ){ s.pb(buttons[1]) ; break ; } s += buttons[2] ; break ; } else s2 = s + buttons[0] + s + buttons[1] + buttons[0] + s + buttons[1] + buttons[1] + s + buttons[1] + buttons[2] ; ans = press ( s2 ) ; if( ans == (int)s.length() ){ s.pb(buttons[2]) ; }else if( ans == (int)s.length() + 1 ){ s.pb(buttons[0]) ; }else if( ans == (int)s.length() + 2 ){ s.pb(buttons[1]); } } assert( (int)s.length() == n) ; return s ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...