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 "combo.h"
#include <iostream>
using namespace std;
string guess_sequence(int N) {
int coins = 1, p;
string S = "";
char c;
if (press("AB") > 0){
if (press("A") > 0) c = 'A';
else c = 'B';
}
else if (press("X") > 0) c = 'X';
else c = 'Y';
S += c;
for(int i = 1; i < N-1; i++){
if (c == 'A'){
p = press(S + "BB" + S + "BX" + S + "BY" + S + "X");
if(p == coins+2) S += 'B';
else if(p == coins+1) S += 'X';
else S += 'Y';
}
if (c == 'B'){
p = press(S + "AA" + S + "AX" + S + "AY" + S + "X");
if(p == coins+2) S += 'A';
else if(p == coins+1) S += 'X';
else S += 'Y';
}
if (c == 'X'){
p = press(S + "AB" + S + "AA" + S + "AY" + S + "Y");
if(p == coins+2) S += 'A';
else if(p == coins+1) S += 'Y';
else S += 'B';
}
if (c == 'Y'){
p = press(S + "AB" + S + "AX" + S + "AA" + S + "X");
if(p == coins+2) S += 'A';
else if(p == coins+1) S += 'X';
else S += 'B';
}
coins++;
}
if(c == 'A'){
if(press(S + "B") > coins) S += 'B';
else if(press(S + "X") > coins) S += 'X';
else S += 'Y';
}
if(c == 'B'){
if(press(S + "A") > coins) S += 'A';
else if(press(S + "X") > coins) S += 'X';
else S += 'Y';
}
if(c == 'X'){
if(press(S + "B") > coins) S += 'B';
else if(press(S + "A") > coins) S += 'A';
else S += 'Y';
}
if(c == 'Y'){
if(press(S + "B") > coins) S += 'B';
else if(press(S + "X") > coins) S += 'X';
else S += 'A';
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |