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 res = "";
string c = "";
if(press("AB")) {
if(press("A")) res += "A";
else res += "B";
} else {
if(press("X")) res += "X";
else res += "Y";
}
if(N == 1) return res;
string ls = "ABXY";
for(int i = 0; i < 4; ++i) {
if(ls[i] == res[0]) {
ls[i] = ls.back();
ls.pop_back();
break;
}
}
for(int i = 1; i < N-1; ++i) {
c.clear();
c += res;
c += ls[0];
c += ls[0];
c += res;
c += ls[0];
c += ls[1];
c += res;
c += ls[0];
c += ls[2];
c += res;
c += ls[1];
int t = press(c);
int m = res.size();
if(t == m) {
res += ls[2];
} else if(t == m+1) {
res += ls[1];
} else if(t == m+2) {
res += ls[0];
}
}
{
if(press(res + ls[0]) == N) {
res += ls[0];
} else if(press(res + ls[1]) == N) {
res += ls[1];
} else {
res += ls[2];
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |