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;
string guess_sequence(int N) {
string s = "";
int pos = 1, x;
vector<char>v;
if (pos == 1){
x = press("AB");
if (!x){
x = press("X");
if (x) s += "X";
else s += "Y";
}
else{
x = press("A");
if (x) s += "A";
else s += "B";
}
pos++;
}
if (s[0] != 'A') v.push_back('A');
if (s[0] != 'B') v.push_back('B');
if (s[0] != 'X') v.push_back('X');
if (s[0] != 'Y') v.push_back('Y');
while (pos < N){
string t = "";
t += s; t += v[0];
t += s; t += v[1]; t += v[0];
t += s; t += v[1]; t += v[1];
t += s; t += v[1]; t += v[2];
x = press(t);
if (x == pos) s += v[0];
else if (x == pos+1) s += v[1];
else s += v[2];
pos++;
}
if (pos == N){
string t = "";
t += s; t += v[0];
x = press(t);
if (x == N) {return t;}
t = s; t += v[1];
x = press(t);
if (x == N) {return t;}
s += v[2];
return s;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |