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 Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
#define INIT(x) do { swap(a[0], a[x]); s += a[0]; } while(0)
std::string guess_sequence(int N) {
string s = "";
char a[4] = {'A', 'B', 'X', 'Y'};
{
if (press("AB"))
if (press("A"))
INIT(0);
else
INIT(1);
else
if (press("X"))
INIT(2);
else
INIT(3);
}
if (N == 1)
return s;
Loop (i,1,N-1) {
int x = press(s + a[2] + s + a[3] + a[1] + s + a[3] + a[2] + s + a[3] + a[3]) - i;
if (x == 0)
s += a[1];
else if (x == 1)
s += a[2];
else /* if (x == 2) */
s += a[3];
}
{
if (press(s + a[1]) == N)
s += a[1];
else if (press(s + a[2]) == N)
s += a[2];
else
s += a[3];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |