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 l=1,k;
string p;
if (press("A")){
p="A";
while (l<N){
if ((k=press(p+"B"))>l){
p+="B";
l++;
}
else if ((k=press(p+"X"))>l){
p+="X";
l++;
}
else {
p+="Y";
l++;
}
}
}
else if (press("B")){
p="B";
while (l<N){
if ((k=press(p+"A"))>l){
p+="A";
l++;
}
else if ((k=press(p+"X"))>l){
p+="X";
l++;
}
else {
p+="Y";
l++;
}
}
}
else if (press("X")){
p="X";
while (l<N){
if ((k=press(p+"B"))>l){
p+="B";
l++;
}
else if ((k=press(p+"A"))>l){
p+="A";
l++;
}
else {
p+="Y";
l++;
}
}
}
else {
p="Y";
while (l<N){
if ((k=press(p+"B"))>l){
p+="B";
l++;
}
else if ((k=press(p+"X"))>l){
p+="X";
l++;
}
else {
p+="A";
l++;
}
}
}
// cerr << p << " \n";
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |