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;
// #define int long long
#define pint pair < int , int >
#define ll long long
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL); cin.tie(NULL)
const int inf = 1e9 + 9;
const int mxn = 2e5 + 2;
const int mod = 1e9 + 7;
// int press(string p) {}
string guess_sequence(int n) {
int t1 = press("AB");
int t2 = press("BX");
char a , b , c , z;
if (t1 == 0) {
a = 'A';
b = 'B';
if (t2 == 0) {
z = 'Y';
c = 'X';
} else {
z = 'X';
c = 'Y';
}
} else {
c = 'Y';
b = 'X';
if (t2 == 0) {
a = 'B';
z = 'A';
} else {
a = 'A';
z = 'B';
}
}
string str;
str = z;
for (int i = 0; i < n-2; i++) {
int t = press(str + a + str + b + a + str + b + b + str + b + c);
int sz = str.size();
if (t - sz > 2) press(str + 'F');
if (t - sz == 0) str += c;
if (t - sz == 1) str += a;
if (t - sz == 2) str += b;
}
int q = press(str + a);
if (q == n) str += a;
else if (q == n-1) {
if (press(str + b) == n) str += b;
else str += c;
}
// if (str.size() != n) press(str + 'F');
return str;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |