# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95577 | rocketninja7 | Combo (IOI18_combo) | C++14 | 70 ms | 588 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"
std::string guess_sequence(int N) {
std::string p = "";
int coinsAB = press("AB");
char buttons[3];
std::string S = "";
if(coinsAB>=1){
int coinsA=press("A");
if(coinsA==1){
S+='A';
buttons[0]='B';
buttons[1]='X';
buttons[2]='Y';
}
else{
S+='B';
buttons[0]='A';
buttons[1]='X';
buttons[2]='Y';
}
}
else{
int coinsX=press("X");
if(coinsX==1){
S+='X';
buttons[0]='A';
buttons[1]='B';
buttons[2]='Y';
}
else{
S+='Y';
buttons[0]='A';
buttons[1]='B';
buttons[2]='X';
}
}
while(S.length()<N){
p=S+buttons[0];
if(press(p)==p.length()){
S+=buttons[0];
}
else{
p=S+buttons[1];
if(press(p)==p.length()){
S+=buttons[1];
}
else{
S+=buttons[2];
}
}
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |