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"
#define DEBUG 0
using namespace std;
string guess_sequence(int N) { // Play with the lucky!
string res, s;
// Find the first letter of string S
if(press("AB") >= 1) {
if(press("A") == 1) {
res = 'A';
s = "BXY";
}
else {
res = 'B';
s = "AXY";
}
}
else {
if(press("X") == 1) {
res = 'X';
s = "ABY";
}
else {
res = 'Y';
s = "ABX";
}
}
// For N = 1
if(N == 1) {
return res;
}
// Solve other letter
for(int i = 1; i < N - 1; i++) {
int coins = press(res + s[0] + res + s[1] + s[0] + res + s[1] + s[1] + res + s[1] + s[2]);
if(coins == i + 1) {
res += s[0];
}
else if(coins == i + 2) {
res += s[1];
}
else {
res += s[2];
}
}
if(press(res + s[0] + res + s[1]) == N) {
if(press(res + s[0]) == N) {
res += s[0];
}
else {
res += s[1];
}
}
else {
res += s[2];
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |