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 n;
string guess_sequence(int N) {
n=N;
string p = "AB";
int coins = press(p);
char dau;
if (coins>=1)
{
p="A";
coins = press(p);
if (coins>=1) dau = 'A';
else dau = 'B';
}
else
{
p="X";
coins = press(p);
if (coins>=1) dau = 'X';
else dau = 'Y';
}
string S="";
S+=dau;
vector <char> tmp;
if (dau!='A') tmp.push_back('A');
if (dau!='B') tmp.push_back('B');
if (dau!='X') tmp.push_back('X');
if (dau!='Y') tmp.push_back('Y');
for (int i=2; i+1<=n; i++)
{
p="";
p+=S+tmp[0];
for (char j:tmp) p+=S+tmp[1]+j;
coins = press(p);
if (coins==i)
S+=tmp[0];
else if (coins>i) S+=tmp[1];
else S+=tmp[2];
}
p=""; p+=S+tmp[0]; p+=S+tmp[1];
coins = press(p);
if (coins==n)
{
p=""; p+=S+tmp[0];
coins = press(p);
if (coins==n) S+=tmp[0];
else S+=tmp[1];
}
else S+=tmp[2];
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |