This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std ;
string guess_sequence( int n ) {
string ans = "" ;
vector <char> vec = { 'A' , 'B' , 'X' , 'Y' } ;
int f = 0 ;
int x = press ( "AB" ) ;
if (x>0){
x = press("A") ;
if(x>0) f = 0 ;
else f = 1 ;
}
else{
x = press("X") ;
if(x>0) f = 2 ;
else f = 3 ;
}
ans += vec[f] ;
swap ( vec[3] , vec[f] ) ;
for ( int i = 1 ; i < n-1 ; i ++ ){
string cur = "" ;
for ( int j = 0 ; j < 3 ; j ++ ) cur += ans+vec[0]+vec[j] ;
cur += ans+vec[1] ;
x = press(cur) ;
if ( x == (int)ans.size() ) ans += vec[2] ;
else if ( x-1 == (int)ans.size() ) ans += vec[1] ;
else ans += vec[0] ;
}
if ( n != 1 ){
x = press( ans+vec[0]+ans+vec[1] ) ;
if ( x == (int)ans.size() ) ans += vec[2] ;
else{
x = press(ans+vec[0]) ;
if(x>(int)ans.size()) ans += vec[0] ;
else ans += vec[1] ;
}
}
return ans ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |