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 = ""+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 = ans+rem[0]+rem[0]+ans+rem[0]+rem[1]+ans+rem[0]+rem[2]+ans+rem[1]+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 = ans+rem[0]+ans+rem[1];
int r = press(e);
if (r == N) {
string t = ans+rem[0];
int y = press(t);
if (y == N) return ans+rem[0];
else return ans+rem[1];
}
return ans+rem[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |