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"
using namespace std;
string guess_sequence(int n) {
string s = "";
string cur = "ABXY";
if (press(s + "AB")){
if (press(s + "A")){
s += "A";
}
else{
s += "B";
}
}
else{
if (press(s + "X")){
s += "X";
}
else{
s += "Y";
}
}
if (n == 1){
return s;
}
string rem = "";
for (int i = 0; i < 4; i++){
if (s[0] != cur[i]){
rem += cur[i];
}
}
int cnt = 1;
for (int i = 1; i < n - 1; i++){
string p = s + rem[0];
for (int j = 0; j < 3; j++){
p += s + rem[1] + rem[j];
}
int point = press(p);
if (point == cnt + 1){
s += rem[0];
}
else if (point == cnt + 2){
s += rem[1];
}
else{
s += rem[2];
}
cnt++;
}
if (press(s + rem[0]) == cnt + 1){
s += rem[0];
}
else if (press(s + rem[1]) == cnt + 1){
s += rem[1];
}
else{
s += rem[2];
}
// cout << s << "\n";
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |