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 s[4] = {"A", "B", "X", "Y"} ;
string ans = "" ;
if(!N) return ans ;
if(press(s[0]+s[1])){
if(press(s[1])) swap(s[0], s[1]) ;
}
else{
if(press(s[2])) swap(s[0], s[2]) ;
else swap(s[0], s[3]) ;
}
ans = s[0] ;
if(N == 1) return ans ;
for(int i = 2 ; i < N ; i++){
int tam = press(ans+s[2]+ans+s[3]+s[1]+ans+s[3]+s[2]+ans+s[3]+s[3]) ;
if(tam == i - 1) ans += s[1] ;
if(tam == i) ans += s[2] ;
else ans += s[3] ;
}
if(press(ans + s[1]) == N) ans += s[1] ;
else if(press(ans + s[2]) == N) ans += s[2] ;
else ans += s[3] ;
return ans ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |