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