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 MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL
#define hashA 1257958787
#define hashB 1539500609
#define endl "\n"
string guess_sequence(int n) {
char st;
vector<char> chs;
if(press("AB")) {
if(press("A")) {
st = 'A';
chs = {'B','X','Y'};
} else {
st = 'B';
chs = {'A','X','Y'};
}
} else {
if(press("X")) {
st = 'X';
chs = {'A','B','Y'};
} else {
st = 'Y';
chs = {'A','B','X'};
}
}
string currs = "";
currs+= st;
for(int i = 2; i < n; i++) {
string ask = currs;
ask+= chs[0];
ask+= currs;
ask+= chs[1];
ask+= chs[0];
ask+= currs;
ask+= chs[1];
ask+= chs[1];
ask+= currs;
ask+= chs[1];
ask+= chs[2];
int x = press(ask);
if(x == i-1) {
currs+= chs[2];
} else if(x == i) {
currs+= chs[0];
} else {
currs+= chs[1];
}
}
string ask = currs;
ask+= chs[0];
if(press(ask) == n) {
currs+= chs[0];
} else {
string askk = currs;
askk+= chs[1];
if(press(askk) == n) {
currs+= chs[1];
} else {
currs+= chs[2];
}
}
return currs;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |