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<string.h>
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
std::string guess_sequence(int N) {
int n = N;
//find first lette
string s = "ABXY";
char f;
string a = "AX";
if(press("AB")){
if(press("A")){
f = 'A';
}else{
f = 'B';
}
}else{
if(press("X")){
f = 'X';
}else{
f = 'Y';
}
}
//cout<<"WTf"<<endl;
s.erase(s.find(f), 1);
string ret = ""; ret += f;
//cout<<"S "<<s<<endl;
//cout<<"RE: "<<ret<<endl;
//cout<<"F: "<<f<<endl;
for(int i = 1; i < N-1; i++){
string t = ret + s[0] + ret + s[1] + s[0] + ret + s[1] + s[1] + ret + s[1] + s[2];
//cout<<"STRING "<<t<<endl;
int coins = press(t);
if(coins == i){
ret += s[2];
}else if(coins == i+1){
ret += s[0];
}else{
ret += s[1];
}
}
if(press(ret + s[0] + ret + s[1]) == n){
if(press(ret + s[0]) == n){
ret += s[0];
}else{
ret += s[1];
}
}else{
ret += s[2];
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |