# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
368197 | Ozy | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
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;
char arr[4];
void llena(lli tam) {
rep(i,1,tam) p += res[i];
res += arr[1]+ arr[1];
rep(i,1,tam) p += res[i];
res += arr[1]+ arr[2];
rep(i,1,tam) p += res[i];
res += arr[1]+ arr[3];
rep(i,1,tam) p += res[i];
res += arr[2];
}
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 = {' ','B','X','Y'};
else if (res == "B") arr = {' ','A','X','Y'};
else if (res == "X") arr = {' ','A','B','Y'};
else arr = {' ','A','B','X'};
rep(i,2,n-1) {
p = "";
llena(i-1);
a = press(p);
if (a > i) res += arr[1];
else if (a == i) res += arr[2];
else res += arr[3];
}
p = res;
p += arr[1];
a = press(p);
if (a == n) {
res += arr[1];
return res;
}
else {
p = res;
p += arr[2];
if (a == n) {
res += arr[2];
return res;
}
else {
res += arr[3];
return res;
}
}
}