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) {
string gg = "ABX";
char fi = 'Y';
for(char c:gg){
string p;
p += c;
// cout <<"inside " << p << "\n";
if(press(p) == 1){
fi = c;
break;
}
}
string s = "";
s += fi;
// <= 3 queries used
// left : = n - 1
for(int i = 1;i < N;i ++){
set<char> lol;
lol.insert('A');
lol.insert('B');
lol.insert('X');
lol.insert('Y');
lol.erase(fi);
vector<char> lmao;
for(char c:lol) lmao.push_back(c);
char lst = lmao.back();
for(int j = 0;j < 2;j++){
char c = lmao[j];
string p;
p += s;
p += c;
if(press(p) == (i + 1)){
lst = c;
break;
}
}
s += lst;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |