This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Challenge: Accepted
#include <bits/stdc++.h>
#include "combo.h"
#pragma GCC optimize("Ofast")
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
while (l != r) cout << *l << " ", l++;
cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 605
#define mod 1000000007
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
string ch = "ABXY";
string guess_sequence(int N) {
string p = "", ret;
char st;
p = "AB";
if (press(p) > 0) {
p = "A";
if (press(p)) st = 'A';
else st = 'B';
} else {
p = "X";
if (press(p)) st = 'X';
else st = 'Y';
}
string rem;
for (int i = 0;i < 4;i++) {
if (ch[i] != st) rem += ch[i];
}
string cur;
cur += st;
if (N == 1) return cur;
for (int i = 1;i < N - 1;i++) {
p.clear();
p += cur;
p += rem[0];
for (int j = 0;j < 3;j++) {
p += cur;
p += rem[1];
p += rem[j];
}
int val = press(p);
if (val == i) {
cur += rem[2];
} else if (val == i + 1) {
cur += rem[0];
} else {
cur += rem[1];
}
}
int last = 0;
for (int i = 1;i < 3;i++) {
p = cur;
p += rem[i];
if (press(p) == N) {
last = i;
break;
}
}
cur += rem[last];
return cur;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |