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;
std::string guess_sequence(int N) {
char cs[4] = {'A', 'B', 'X', 'Y'};
string res = "";
for (int i = 0; i < 4; i++) {
string s = "";
s += cs[i];
s += cs[i];
if (press(s) == 1) {
res += cs[i];
cs[i] = '0';
// cout << res << endl;
break;
}
}
if (N == 1) {
return res;
}
for (int i = 1; i < N; i++) {
for (int e = 0; e < 4; e++) {
if (cs[e] == '0') {
continue;
}
string check = res;
check += cs[e];
// cout << check;
if (press(check) == i + 1) {
res += cs[e];
break;
}
}
}
// cout << res << endl;
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |