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>
#define siz(x) int((x).size())
using namespace std;
string guess_sequence(int N) {
string p;
string a="A", b="B", c="X", d="Y";
// 2
if (!press(a+b)) swap(a,c),swap(b,d);
if (!press(a)) swap(a,b);
if (N == 1) return a;
p = a;
// N-2
for (;siz(p) < N-1;) {
string q;
q += p+b;
q += p+c+b;
q += p+c+c;
q += p+c+d;
int x = press(q);
if (x == siz(p)) p += d;
if (x == siz(p)+1) p += b;
if (x == siz(p)+2) p += c;
}
// 2
if (press(p+b+p+c) == N-1) p += d;
else if (press(p+b) == N-1) p += c;
else p += b;
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |