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