This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// M
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
string G[4] = {"A", "B", "X", "Y"};
string guess_sequence(int n)
{
if (!press("AB"))
swap(G[0], G[2]), swap(G[1], G[3]);
if (!press(G[0]))
swap(G[0], G[1]);
string Rs = G[0];
if (n == 1)
return Rs;
for (int i = 1; i < n - 1; i ++)
{
string P = Rs + G[1] + G[1] + Rs + G[1] + G[2] + Rs + G[1] + G[3] + Rs + G[2];
int c = press(P) - (int)Rs.size();
if (c == 0)
Rs += G[3];
else if (c == 1)
Rs += G[2];
else
Rs += G[1];
}
if (press(Rs + G[1]) == n)
Rs += G[1];
else if (press(Rs + G[2]) == n)
Rs += G[2];
else
Rs += G[3];
cout << Rs << endl;
return Rs;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |