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 len(a) ((int)(a).size())
string guess_sequence(int N) {
string p = "";
int x;
x = press("AB");
if(x == 2) p += "AB";
else if(x){
x = press("A");
if(x) p += "A";
else p += "B";
}
else{
x = press("X");
if(x) p += "X";
else p += "Y";
}
char ch[4] = {'A', 'B', 'X', 'Y'};
for(int i = len(p) + 1; i <= N; i++){
for(int j = 0, z = 0; j < 4; j++){
if(ch[j] == p[0]) continue;
z++;
if(z == 3) p += ch[j];
else {
x = press(p + ch[j]);
if(x == i){
p += ch[j];
break;
}
}
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |