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) {
char head;
if (press("AB")) {
if (press("A")) head = 'A';
else head = 'B';
}
else {
if (press("X")) head = 'X';
else head = 'Y';
}
string pref; pref.push_back(head);
if (n == 1) return pref;
vector<char> C;
if (head != 'A') C.push_back('A');
if (head != 'B') C.push_back('B');
if (head != 'X') C.push_back('X');
if (head != 'Y') C.push_back('Y');
for(int i = 2; i < n; i++) {
int tmp = press(pref + C[0] + pref + C[1] + C[0] + pref + C[1] + C[1] + pref + C[1] + C[2]);
if (tmp == i - 1) pref += C[2];
else if (tmp == i) pref += C[0];
else pref += C[1];
}
if (press(pref + C[0]) == n) pref.push_back(C[0]);
else if (press(pref + C[1]) == n) pref.push_back(C[1]);
else pref.push_back(C[2]);
return pref;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |