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 <iostream>
#include "combo.h"
using namespace std;
string guess_sequence( int n ) {
char a, b, x, y;
int l, i;
string ans;
ans = "";
if ( press( "AB" ) ) {
if ( press( "A" ) ) {
a = 'B';
b = 'X';
x = 'Y';
y = 'A';
} else {
a = 'A';
b = 'X';
x = 'Y';
y = 'B';
}
} else {
if ( press( "X" ) ) {
a = 'A';
b = 'B';
x = 'Y';
y = 'X';
} else {
a = 'A';
b = 'B';
x = 'X';
y = 'Y';
}
}
ans += y;
for ( i = 2; i < n; i++ ) {
l = press( (ans + a) + (ans + b + a) + (ans + b + b) + (ans + b + x) );
if ( l == i )
ans += a;
else if ( l == i + 1 )
ans += b;
else
ans += x;
}
if ( n > 1 ) {
if ( y != 'A' && press( ans + 'A' ) == n )
ans += 'A';
else if ( y != 'B' && press( ans + 'B' ) == n )
ans += 'B';
else if ( y == 'Y' || (y != 'X' && press( ans + 'X' ) == n) )
ans += 'X';
else
ans += 'Y';
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |