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 <bits/stdc++.h>
using namespace std;
#include "combo.h"
std::string guess_sequence(int n) {
std::string p = "";
string s;
if (press ("AB"))
{
if (press ("A")) s = "A";
else s = "B";
}
else
{
if (press ("X")) s = "X";
else s = "Y";
}
if (n == 1) return s;
char c1 = 'A', c2 = 'B', c3 = 'X';
if (s[0] == c1) c1 = 'Y';
if (s[0] == c2) c2 = 'Y';
if (s[0] == c3) c3 = 'Y';
for (int i = 1; i < n - 1; ++i)
switch (press (s + c1
+ s + c2 + c1
+ s + c2 + c2
+ s + c2 + c3)
- s.size ())
{
case 0:
s += c3;
break;
case 1:
s += c1;
break;
case 2:
s += c2;
break;
}
if (press (s + c1) == n) s += c1;
else if (press (s + c2) == n) s += c2;
else s += c3;
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |