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){
string rez, l;
if(press("AB")){
if(press("A")){
rez += 'A';
l = "BXY";
}
else{
rez += 'B';
l = "AXY";
}
}
else if(press("X")){
rez += 'X';
l = "ABY";
}
else{
rez += 'Y';
l = "ABX";
}
for(int i = 2; i < n; i++){
string temp = "";
for(auto x : l) temp += rez + l[0] + x;
temp += rez + l[1];
int x = press(temp);
if(x == i + 1) rez += l[0];
else if(x == i) rez += l[1];
else rez += l[2];
}
if(n > 1){
if(press(rez + l[0]) == n) rez += l[0];
else if(press(rez + l[1]) == n) rez += l[1];
else rez += l[2];
}
return rez;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |