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;
int i;
string s, p;
char m[4];
std::string guess_sequence(int N)
{
int c = press("AB");
if(c)
{
if(press("AY")) s += 'A', m[0] = 'B', m[1] = 'X', m[2] = 'Y';
else s += 'B', m[0] = 'A', m[1] = 'X', m[2] = 'Y';
}
else
{
if(press("AY")) s += 'Y', m[0] = 'A', m[1] = 'B', m[2] = 'X';
else s += 'X', m[0] = 'A', m[1] = 'B', m[2] = 'Y';
}
for(i = 1; i < N - 1; i++)
{
p = s + m[0] + m[0] + s + m[0] + m[1] + s + m[0] + m[2] + s + m[1];
c = press(p);
if(c == i + 2) s += m[0];
else if(c == i + 1) s += m[1];
else s += m[2];
}
if(N > 1) {
p = s + m[0];
if(press(p) == N) s += m[0];
else
{
p = s + m[1];
if(press(p) == N) s += m[1];
else s += m[2];
} }
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |