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