# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161091 | giorgikob | 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 "combo.h"
#include <string>
std::string guess_sequence(int N) {
std::string S = "";
int x = press("AB");
if(x == 1){
x = press("A");
if(x==1){
S += 'A';
} else {
S += 'B';
}
} else {
x = press("X");
if(x==1){
S += "X";
} else {
S += "Y";
}
}
std::string c1,c2,c3;
if(S=="X") c1 = "A", c2 = "B", c3 = "Y";
if(S=="Y") c1 = "A", c2 = "B", c3 = "X";
if(S=="A") c1 = "B", c2 = "X", c3 = "Y";
if(S=="B") c1 = "A", c2 = "X", c3 = "Y";
for(int i=1;i<N;i++){
int x = (S+c1+S+c2+c1+S+c2+c2+S+c2+c3);
if(x==S.size());
S += c3;
if(x==S.size()+1)
S += c1;
if(x==S.size()+2)
S += c2;
}
return S;
}