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;
std::string guess_sequence(int N) {
//first part: Getting the first letter
string first = "";
int fcoin = press("XY");
if (fcoin){
if(press("X"))
first = "X";
else
first = "Y";
}
else{
if(press("A"))
first = "A";
else
first = "B";
}
string posibles = "",ans = first;
if(first == "A") posibles = "BXY";
else if(first == "B") posibles = "AXY";
else if(first == "X") posibles = "ABY";
else posibles = "ABX";
for(int i = 1; i < N; ++i){
string test = ans + posibles[0] + ans + posibles[1];
if(press(test) > i){
if(press(test.substr(0,i+1)) > i)
ans += posibles[0];
else
ans += posibles[1];
}
else
ans += posibles[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |