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>
#include "combo.h"
using namespace std;
string guess_sequence(int n)
{
int i, j, cur;
char ch;
string s = "", guess="ABXY", t;
//tentuin karakter pertama dulu
if (press("AB")>0)
{
if (press("A")) s += 'A';
else s += 'B';
} else if (press("X")) s += 'X';
else s += 'Y';
for (i=0; i<4; i++)
{
if (guess[i] == s[0])
{
guess.erase(guess.begin()+i);
break;
}
}
for (i=2; i<=n-1; i++)
{
//p00 p01 p02 p1
// printf("s now = %s\n", s.c_str());
t = "";
for (j=0; j<=2; j++) t += s+guess[0]+guess[j];
t += s+guess[1];
cur = press(t)-i+1;
s += guess[2-(cur)];
}
//karakter terakhir
ch = guess[2];
for (i=0; i<=1; i++)
{
if (press(s+guess[i]) == n) ch = guess[i];
}
s += ch;
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |