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;
const int N = 2e3 + 42;
char c[N], let[4];
std::string guess_sequence(int n) {
for(int i = 0; i < n; i++)
c[i] = '#';
int l = press("AB");
if(l == 0) {
l = press("X");
if(l == 0)
c[0] = 'Y';
else
c[0] = 'X';
} else if(l == 1) {
l = press("A");
if(l == 0)
c[0] = 'B';
else
c[0] = 'A';
} else {
c[0] = 'A';
c[1] = 'B';
}
let[0] = 'A';
let[1] = 'B';
let[2] = 'X';
let[3] = 'Y';
for(int i = 0; i < 4; i++)
if(let[i] == c[0])
let[i] = 'Z';
sort(let, let + 4);
string tot = "";
tot += c[0];
for(int i = 1; i < n-1; i++) {
if(c[i] == '#') {
l = press(tot + let[0] + tot + let[1] + let[0] + tot + let[1] + let[1] + tot + let[1] + let[2]);
if(l == i)
c[i] = let[2];
else if(l == i+1)
c[i] = let[0];
else
c[i] = let[1];
}
tot += c[i];
}
if(n != 1) {
l = press(tot + let[0] + tot + let[1]);
if(l == n) {
l = press(tot + let[0]);
if(l == n)
c[n-1] = let[0];
else
c[n-1] = let[1];
} else {
c[n-1] = let[2];
}
tot += c[n-1];
}
return tot;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |