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 ans = "";
int ps( char x )
{
string s = ans;
s += x;
return press( s );
}
std::string guess_sequence(int N) {
string p = "";
if( press( "AB" ) == 0 )
{
if( press( "X" ) == 1 )
ans = "X";
else
ans = "Y";
}
else
{
if( press( "A" ) == 1 )
ans = "A";
else
ans = "B";
}
if( ans == "A" )
p = "BXY";
if( ans == "B" )
p = "AXY";
if( ans == "X" )
p = "ABY";
if( ans == "Y" )
p = "ABX";
for( int i = 1; i < N; i ++ )
{
if( ps( p[2] ) == i+1 )
ans += p[2];
else if( ps( p[1] ) == i+1 )
ans += p[1];
else
ans += p[0];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |