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;
typedef long long ll;
std::string guess_sequence(int N) {
string s = "ABXY";
string S = "";
string t = "";
string A = "";
if(press("AB")){
if(press("A")){
S += s[0];
}
else{
S += s[1];
}
}
else{
if(press("X")){
S += s[2];
}
else{
S += s[3];
}
}
A += S[(int)S.size()-1];
for(int i=0;i<4;i++){
if(S[(int)S.size()-1] == s[i]){
for(int j=0;j<4;j++){
if(s[j] != s[i]){
t += s[j];
}
}
}
}
if(N == 1){
return A;
}
for(int i=1;i<N-1;i++){
string st = A+t[0]+A+t[1]+t[1]+A+t[1]+t[0]+A+t[1]+t[2];
int p = press(st);
A += t[(p-i+2)%3];
}
if(press(A+t[0]) == N){
A += t[0];
}
else if(press(A+t[1]) == N){
A += t[1];
}
else{
A += t[2];
}
return A;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |