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;
std::string guess_sequence(int N) {
vector<char> lst{'A', 'B', 'X', 'Y'};
std::string p = "";
if (press(p + lst[0] + p + lst[1]) >= 1) {
if (press(p + lst[0]) == 1){
p += lst[0];
lst.erase(lst.begin() + 0);
}
else {
p += lst[1];
lst.erase(lst.begin() + 1);
}
}
else if (press(p + lst[2]) == 1) {
p += lst[2];
lst.erase(lst.begin() + 2);
}
else {
p += lst[3];
lst.erase(lst.begin() + 3);
}
for (int j = 2; j < N; j++) {
int result = press(p + lst[0] + p + lst[1] + lst[0] + p + lst[1] + lst[1] + p + lst[1] + lst[2]);
if (result == j) p += lst[0];
else if (result == j + 1) p += lst[1];
else p += lst[2];
}
if (press(p + lst[0] + p + lst[1]) != N) p += lst[2];
else if (press(p + lst[0]) == N) p += lst[0];
else p += lst[1];
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |