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) {
char one;
int x = press("AB");
if (x > 0) {
int y = press("A");
if (y == 1) one = 'A';
else one = 'B';
} else {
int y = press("X");
if (y == 1) one = 'X';
else one = 'Y';
}
string ans = "";
ans += one;
vector<char> stuff = {'A','B','X','Y'};
vector<char> rem;
for (char c : stuff) {
if (c != one) rem.push_back(c);
}
for (int q = 2; q < N; q++) {
string w = "";
for (int e = 0; e < 2; e++) {
w += ans;
w += rem[0];
w += rem[e];
}
w += ans;
w += rem[1];
w += one;
int y = press(w);
if (y == q+1) {
ans += rem[0];
} else if (y == q) {
ans += rem[1];
} else {
ans += rem[2];
}
}
if (N == 1) return ans;
string e = "";
for (int q = 0; q < 2; q++) {
e += ans;
e += rem[q];
}
int r = press(e);
if (r == N) {
string t = ans;
t += rem[0];
int y = press(t);
if (y == N) ans += rem[0];
else ans += rem[1];
}
else ans += rem[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |