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;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define lli long long int
#define debug(a) cout << #a << " = " << a << endl
string res,p;
lli a;
vector<char> arr;
void llena(lli tam) {
p = res.substr(0, tam);
p += arr[0];
p += arr[0];
p += res.substr(0, tam);
p += arr[0];
p += arr[1];
p += res.substr(0, tam);
p += arr[0];
p += arr[2];
p += res.substr(0, tam);
p += arr[1];
}
string guess_sequence(int N) {
a = press("AB");
if (a > 0){
a = press("A");
if (a == 1) res = "A";
else res = "B";
}
else {
a = press("X");
if (a == 1) res = "X";
else res = "Y";
}
if (res != "A") arr.push_back('A');
if (res != "B") arr.push_back('B');
if (res != "X") arr.push_back('X');
if (res != "Y") arr.push_back('Y');
rep(i,2,N-1) {
p = "";
llena(i-1);
a = press(p);
if (a > i) res += arr[0];
else if (a == i) res += arr[1];
else res += arr[2];
}
if (N == 1) return res;
p = res;
p += arr[0];
a = press(p);
if (a == N) {
res += arr[0];
return res;
}
else {
p = res;
p += arr[1];
a = press(p);
if (a == N) {
res += arr[1];
return res;
}
else {
res += arr[2];
return res;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |