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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence (int N){
vector<char>sec(3);
string ans = "";
if (press("AB") > 0){
if (press("A")) {
ans += 'A';
sec[0] = 'B';
}
else {
ans += 'B';
sec[0] = 'A';
}
sec[1] = 'X';
sec[2] = 'Y';
}
else{
sec[0] = 'A';
sec[1] = 'B';
if (press("X")) {
ans += 'X';
sec[2] = 'Y';
}
else {
ans += 'Y';
}
}
for (int i = 2; i < N; ++i){
string guess = ans + sec[0] + ans + sec[1] + sec[0] + ans + sec[1] + sec[1] + ans + sec[1] + sec[2];
int x = press(guess);
if (x == i) ans += sec[0];
else if (x == i+1) ans += sec[1];
else ans += sec[2];
}
string fguess = ans + sec[0];
if (press(ans+sec[0]) == N)return ans+ sec[0];
else if (press(ans+sec[1]) == N) return ans + sec[1];
else return ans + sec[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |