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>
using namespace std;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef long long ll;
#define PB push_back
#define MP make_pair
#define FOR(i, x, y) for (ll i = x; i < y ; i ++)
#include <combo.h>
string guess_sequence(int n){
string s;
string l[] = {"A", "B", "X", "Y"};
string start;
vector<string> m;
if (press("AB")){
if (press("A")){
start ="A";
}
else start = "B";
}
else if (press("X")) start = "X";
else start = "Y";
s = start;
FOR(i, 0, 4){
if (l[i] != start){
m.PB(l[i]);
}
}
FOR(i, 0, n - 2){
int guess = press(s + m[0] + s + m[1] + m[0] + s + m[1] + m[1] + s + m[1] + m[2]);
guess -= (i + 1);
if (guess == 0){
s += m[2];
}
else if (guess == 1){
s += m[0];
}
else {
s += m[1];
}
}
if (n == 1) return s;
if (press(s + "A" + s + "B") == n){
if (press(s + "A") == n) s += "A";
else s += "B";
}
else if (press(s + "X") == n){
s += "X";
}
else s += "Y";
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |