# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
397693 | drekavac | Combo (IOI18_combo) | C++14 | 0 ms | 0 KiB |
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 <iostream>
#include <vector>
using namespace std;
vector<char> c;
string guess_sequence(int n){
//pogodi prvi karakter
char f;
if(press("AB")){
if(press("A")) f = 'A';
else f = 'B';
}
else if(press("X")) f = 'X';
else f = 'Y';
if('A'!=f) c.push_back('A');
if('B'!=f) c.push_back('B');
if('X'!=f) c.push_back('X');
if('Y'!=f) c.push_back('Y');
string p = "";
p += f;
for(int i=1; i<n-1; i++){
string pr = "";
pr += p + c[0] + c[0] + p + c[0] + c[1] + p + c[0] + c[2] + p + c[1];
if(press(pr) == p.length()) p += c[2];
else if(press(pr) == p.length()+1) p += c[1];
else p += c[0];
}
if(press(p+c[0]) == n) p+=c[0];
else if(press(p+c[1]) == n) p+=c[1];
else p+=c[2];
return p;
}