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<bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
string p;
//p = "";
//p+="AB";
//int coins = press(p);
if(press("AB")==0){
if(press("X")==0){
//first = Y
p = "Y";
for(int i=1;i<=N-1;i++){
if(press(p+'A')==i+1){
p+='A';
}
else if(press(p+'B')==i+1){
p+='B';
}
else{
p+='X';
}
}
}
else{
//first = x
p = "X";
for(int i=1;i<=N-1;i++){
if(press(p+'A')==i+1){
p+='A';
}
else if(press(p+'B')==i+1){
p+='B';
}
else{
p+='Y';
}
}
}
}
else{
if(press("A")==0){
//first = B
p = "B";
for(int i=1;i<=N-1;i++){
if(press(p+'A')==i+1){
p+='A';
}
else if(press(p+'Y')==i+1){
p+='Y';
}
else{
p+='X';
}
}
}
else{
//first = A
p = "A";
for(int i=1;i<=N-1;i++){
if(press(p+'Y')==i+1){
p+='Y';
}
else if(press(p+'B')==i+1){
p+='B';
}
else{
p+='X';
}
}
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |