이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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" ;
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]) ;
while ( (int)s.length() != n ){
s2 = s + buttons[1] + buttons [0];
int m = s.length();// cout<<s<<" "<<m<<endl;
ans = press(s2) ;
if( ans == m + 1 ) s += buttons[1] ;
else if( ans == m + 2 ) s += buttons[1] , s += buttons [0] ;
else {
if( n -1 == m ){
s += buttons[2];
continue ;
}
s2 = s + buttons[2] + buttons[0] ;
ans = press ( s2 ) ;
if( ans == m + 1 ) s += buttons[2] ;
else if( ans == m + 2 ) s = s2 ;
}
}
assert( (int)s.length() == n) ;
return s ;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |