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;
char alfabet[4] = {'A', 'B', 'X', 'Y'};
std::string guess_sequence(int n) {
if(press("AB")){
if(press("A"))
swap(alfabet[0], alfabet[3]);
else
swap(alfabet[1], alfabet[3]);
}
else{
if(press("X"))
swap(alfabet[2], alfabet[3]);
else
swap(alfabet[3], alfabet[3]);
}
string p = "";
p+=alfabet[3];
if(n==1)return p;
for(int i=2;i<n;i++){
string pom = p+alfabet[0]+p+alfabet[1]+alfabet[0]+p+alfabet[1]+alfabet[1]+p+alfabet[1]+alfabet[2];
int w = press(pom);
if(w==(int)p.size())
p+=alfabet[2];
else if(w==(int)p.size()+1)
p+=alfabet[0];
else
p+=alfabet[1];
}
if(press(p+alfabet[0])>(int)p.size()){
p+=alfabet[0];
}
else if(press(p+alfabet[1])>(int)p.size())
p+=alfabet[1];
else
p+=alfabet[2];
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |