# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1141991 | ad_oux | Combo (IOI18_combo) | C++20 | 0 ms | 0 KiB |
std::string guess_sequence(int N) {
if (N==3){
std::string p = "";
int doubled{-1};
std::string conseq = "";
std::string S = "";
if (press("A")==0){conseq+="BXY";}
else if (press("B")==0){conseq+="AXY";}
else if (press("X")==0){conseq+="ABY";}
else if (press("Y")==0){conseq+="ABX";}
for(int i = 0 ; i < 3 ; i++){
if (press(conseq[i]+conseq[i])==2){doubled = i ;break ;}
}
if (doubled == -1){
for(int i = 0 ; i < 3 ; i++){
if ( press(conseq[i]+conseq[(i+1)%3]+conseq[(i+2)%3])==3){S += conseq[i]+conseq[(i+1)%3]+conseq[(i+2)%3];break ;}
}
}
else {
for(int i = 0 ; i < 3 ; i++){
if (i!= doubled && press(conseq[i]+conseq[doubled]+conseq[doubled])==3){S += conseq[i]+conseq[doubled]+conseq[doubled];break ;}
}
}
return S;
}
else {
return "HeLLO THERE" ;
}
}