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<bits/stdc++.h>
using namespace std;
std::string guess_sequence(int N) {
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;
string temp = "ABXY";
string pos = "";
for (auto c : temp) if (c != s[0]) pos += c;
for (int i = 1; i < N-1; i++)
{
int l = s.size();
string q = s + pos[0];
for (auto c : pos) q += s + pos[1] + c;
int r = press(q);
if (r == l+1) s += pos[0];
else if (r == l+2) s += pos[1];
else s += pos[2];
}
int i;
for (i = 0; i < 2; i++)
if (press(s + pos[i]) == N) break;
return s + pos[i];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |