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 p = "";
if (press("AB") > 0) {
if (press("A") > 0) p += 'A';
else p += 'B';
}
else {
if (press("X") > 0) p += 'X';
else p += 'Y';
}
if (N == 1) return p;
vector<string> stuff;
if (p != "A") stuff.push_back("A");
if (p != "B") stuff.push_back("B");
if (p != "X") stuff.push_back("X");
if (p != "Y") stuff.push_back("Y");
for (int i = 2; i < N; i++) {
string guess = p + stuff[0] + p + stuff[1] + stuff[0] +
p + stuff[1] + stuff[1] + p + stuff[1] + stuff[2];
int val = press(guess);
if (val == i) p += stuff[0];
else if (val == i+1) p += stuff[1];
else p += stuff[2];
// cout << "I think the prefix is: " << p << endl;
}
if (press(p + "A" + p + "B") == N) {
if (press(p+"A") == N) p += 'A';
else p += 'B';
}
else {
if (press(p + "X") == N) p += 'X';
else p += 'Y';
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |