#include <string>
using namespace std;
// You will get this function from the interactive judge
int press(string p);
string guess_sequence(int N) {
string buttons = "ABXY";
char first;
for (char c : buttons) {
if (press(string(1, c)) == 1) {
first = c;
break;
}
}
string answer = string(1, first);
string rest;
for (char c : buttons)
if (c != first) rest += c;
while (answer.length() < N) {
for (char c : rest) {
string trial = answer + c;
if (press(trial) == trial.length()) {
answer += c;
break;
}
}
}
return answer;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |