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