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 <cstring>
#include <string>
using namespace std;
string guess_sequence(int n)
{
string guess;
string available;
int rez;
// first character
rez = press("AB");
if (rez >= 1) {
rez = press("A");
if (rez) {
guess.push_back('A');
available = "BXY";
}
else {
guess.push_back('B');
available = "AXY";
}
}
else {
rez = press("X");
if (rez) {
guess.push_back('X');
available = "ABY";
}
else {
guess.push_back('Y');
available = "ABX";
}
}
// contained characters
for (int i = 2; i < n; i++) {
string aux;
aux = guess + available[0];
for (int j = 0; j <= 2; j++) {
aux = aux + guess + available[1] + available[j];
}
rez = press(aux) - i + 1;
if (rez == 1) {
guess.push_back(available[0]);
}
else if (rez == 2) {
guess.push_back(available[1]);
}
else {
guess.push_back(available[2]);
}
}
// end character
rez = press(guess + available[0]);
if (rez == n) {
return guess + available[0];
}
rez = press(guess + available[1]);
if (rez == n) {
return guess + available[1];
}
return guess + available[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |