This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
Zadanie: Combo
Autor: Tomasz Kwiatkowski
*/
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N)
{
char c[4] = {'A', 'B', 'X', 'Y'};
if (press("AB")) {
if (press("B"))
swap(c[0], c[1]);
}
else {
if (press("X"))
swap(c[0], c[2]);
else
swap(c[0], c[3]);
}
string pref;
pref += c[0];
if (N == 1)
return pref;
for (int i = 1; i < N-1; ++i) {
int k = press(pref + c[1] + pref + c[2] + c[1] + pref + c[2] + c[2] + pref + c[2] + c[3]);
if (k == i)
pref += c[3];
else if (k == i + 1)
pref += c[1];
else
pref += c[2];
}
if (press(pref + c[1]) == N)
return pref + c[1];
if (press(pref + c[2]) == N)
return pref + c[2];
return pref + c[3];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |