#include "combo.h"
#include <string>
#include <iostream>
#include <random>
#include <assert.h>
using namespace std;
char ci[4] = {'A', 'B', 'X', 'Y'};
string S;
int N;
int upr(int n, string kr){
assert(kr.size() <= 4 * n);
return press(kr);
}
string guess_sequence(int N) {
string ab = "AB";
string ret = "";
char x = 0, y = 0, z = 0;
if(upr(N, ab) >= 1){
if(upr(N, "A") == 1) ret += 'A';
else ret += 'B';
}
else{
if(upr(N, "X") == 1) ret += 'X';
else ret += 'Y';
}
for(int i = 0; i < 4; i ++){
if(ci[i] == ret[0]) continue;
if(x == 0) x = ci[i];
else if(y == 0) y = ci[i];
else z = ci[i];
}
for(int i = 2; i <= N; i ++){
if(i == N){
if(upr(N, ret + x) == N) ret += x;
else if(upr(N, ret + y) == N) ret += y;
else ret += z;
}
else{
string chk;
chk += (ret + x + x);
chk += (ret + x + y);
chk += (ret + x + z);
chk += (ret + y);
int pr = upr(N, chk);
if(pr >= i + 1) ret += x;
else if(pr == i) ret += y;
else ret += z;
}
}
//cout << ret;
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |