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 fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
string guess_sequence(int N) {
char prim;
string curr="";
int aux=press("AB");
if(aux){
aux=press("A");
if(aux) prim='A';
else prim='B';
}
else{
aux=press("X");
if(aux) prim='X';
else prim='Y';
}
curr+=prim;
if(N==1) return curr;
vector<char> vals;
if(prim=='A')
vals={'B', 'X', 'Y'};
else if(prim=='B')
vals={'A', 'X', 'Y'};
else if(prim=='X')
vals={'A', 'B', 'Y'};
else
vals={'A', 'B', 'X'};
for(int i=2;i<N;i++){
string q=(curr+vals[0])+(curr+vals[1]+vals[0])+(curr+vals[1]+vals[1])+(curr+vals[1]+vals[2]);
int at=press(q);
if(at==i-1) curr+=vals[2];
else if(at==i) curr+=vals[0];
else curr+=vals[1];
}
aux=press(curr+vals[0]);
if(aux==N) curr+=vals[0];
else{
aux=press(curr+vals[1]);
if(aux==N) curr+=vals[1];
else curr+=vals[2];
}
return curr;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |