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;
int ans, cnt;
string S, first, aux, let1, let2, let3;
string guess_sequence ( int N )
{
cnt = 1;
ans = press ( "AB" );
if ( ans == 0 )
{
ans = press ( "X" );
if ( ans == 0 )
first = "Y", S = "Y";
else
first = "X", S = "X";
}
else if ( ans == 1 )
{
ans = press ( "A" );
if ( ans == 0 )
first = "B", S = "B";
else
first = "A", S = "A";
}
else if ( ans == 2 )
first = "A", S = "AB", cnt = 2;
if ( first == "A" )
let1 = "B", let2 = "X", let3 = "Y";
else if ( first == "B" )
let1 = "A", let2 = "X", let3 = "Y";
else if ( first == "X" )
let1 = "A", let2 = "B", let3 = "Y";
else if ( first == "Y" )
let1 = "A", let2 = "B", let3 = "X";
for ( ; cnt < N - 1; cnt++ )
{
aux = S + let1;
aux += S + let2 + let1;
aux += S + let2 + let2;
aux += S + let2 + let3;
ans = press ( aux );
if ( ans == cnt + 1 )
S += let1;
else if ( ans == cnt + 2 )
S += let2;
else if ( ans == cnt )
S += let3;
}
if ( cnt < N )
{
ans = press ( S + let1 + S + let2 );
if ( ans == cnt )
S += let3;
else if ( ans == cnt + 1 )
{
ans = press ( S + let1 );
if ( ans == cnt )
S += let2;
else
S += let1;
}
}
//cout << S << "\n";
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |