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 <bits/stdc++.h>
#include "combo.h"
using namespace std ;
string guess_sequence(int N) {
vector < string > s, a = { "A", "B", "X", "Y"} ;
string ans = "", p = "";
int cnt = 1, cc;
if( press("AB") ) {
if( press("A") ) {
ans ="A";
s = { "B", "X", "Y"} ;
}
else {
ans ="B";
s = {"A", "X", "Y" };
}
}
else {
if( press("X") ) {
ans ="X";
s = {"A", "B", "Y"};
}
else{
ans ="Y";
s = {"A", "B", "X"};
}
}
while( cnt != N ) {
if( cnt + 1 == N ) {
p = ans + s[0] + ans + s[1] ;
cc = press(p) ;
if( cc == cnt + 1 ) {
p = ans + s[0] ;
cc = press(p) ;
if( cc == cnt + 1 ) ans += s[0] ;
else ans += s[1] ;
}
else ans += s[2] ;
break ;
}
p = ans + s[0] + ans + s[1] + s[0] + ans + s[1] + s[1] + ans + s[1] + s[2] ;
cc = press(p) ;
if( cc == cnt + 2 ) {
ans += s[1] ;
cnt ++ ;
}
else if( cc == cnt + 1 ) {
ans += s[0] ;
cnt ++ ;
}
else {
ans += s[2] ;
cnt ++ ;
}
}
return ans ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |