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;
char start( string &s )
{
char c;
if ( press("A") ) c = 'A';
else if ( press("B") ) c = 'B';
else if ( press("X") ) c = 'X';
else c = 'Y';
for ( auto i: "ABXY" ) {
if ( i != c ) s += i;
}
return c;
}
char end( string S, string s, int N )
{
if ( press(S + s[0]) == N ) return s[0];
else if ( press(S + s[1]) == N ) return s[1];
return s[2];
}
string generate( string S, string s )
{
return S + s[0] + S + s[1] + s[0] + S + s[1] + s[1] + S + s[1] + s[2];
}
string guess_sequence(int N)
{
string S, s, p;
S += start(s);
for ( int i = 1; i < N - 1; i++ ) {
p = generate( S, s );
int x = press(p);
if ( x == i + 1 ) S += s[0];
else if ( x == i ) S += s[2];
else S += s[1];
}
if ( N != 1 )
S += end(S, s, N);
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |