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;
int n;
string guess_sequence(int N){
n = N;
string ans;
char temp;
if (press("AB")){
temp = press("A") ? 'A' : 'B';
}
else {
temp = press("X") ? 'X' : 'Y';
}
ans.push_back(temp);
if (n == 1){
return ans;
}
// cout << ans << "\n";
vector<char> pos;
if (temp != 'A'){
pos.push_back('A');
}
if (temp != 'B'){
pos.push_back('B');
}
if (temp != 'X'){
pos.push_back('X');
}
if (temp != 'Y'){
pos.push_back('Y');
}
for (int i = 1; i < n-1; i++){
string cur;
for (int j = 0; j < 3; j++){
cur += ans+pos[0]+pos[j];
}
cur += ans+pos[1];
int uwu = press(cur);
//cout << cur << " " << uwu << " ";
if (uwu == i+2){
ans.push_back(pos[0]);
}
if (uwu == i+1){
ans.push_back(pos[1]);
}
if (uwu == i){
ans.push_back(pos[2]);
}
//cout << ans << "\n";
}
if (press(ans+pos[0]+ans+pos[1]) >= n){
temp = (press(ans+pos[0])>=n) ? pos[0] : pos[1];
}
else {
temp = pos[2];
}
ans.push_back(temp);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |