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