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>
using namespace std;
#include "combo.h"
string guess_sequence( int n ) {
int i;
string p = "AX";
string ans = "";
char let[4] = { 'B', 'X', 'Y', 'A' };
if( press( p ) != 0 ) {
if( press( "A" ) == 1 )
ans += 'A';
else
ans += 'X', swap( let[1], let[3] );
}
else {
if( press( "B" ) == 1 )
ans += 'B', swap( let[0], let[3] );
else
ans += 'Y', swap( let[2], let[3] );
}
for( i = 2; i < n; i++ ) {
string p = ans + let[0] + ans + let[1] + let[0] + ans + let[1] + let[1] + ans + let[1] + let[2];
int nr = press( p );
if( nr == i - 1 )
ans += let[2];
else if( nr == i )
ans += let[0];
else if( nr == i + 1 )
ans += let[1];
}
if( press( ans + let[0] ) == n )
ans += let[0];
else if( press( ans + let[1] ) == n )
ans += let[1];
else ans += let[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |