# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
261627 | AASG | Combo (IOI18_combo) | C++11 | 41 ms | 808 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 = "";
std::string L = "ABXY";
std::string S;
if(press("AB")>0){
if(press("A")>0){
S="A";
L="BXY";
}else{
S="B";
L="AXY";
}
}else{
if(press("X")>0){
S="X";
L="ABY";
}else{
S="Y";
L="ABX";
}
}
int coins=1, x=0, c=0;
for(int i=1;i<N-1;i++){
x=press(S+L[0]+L[0]+S+L[0]+L[1]+S+L[0]+L[2]+S+L[1]);
if(x-coins==2) S=S+L[0];
else if(x-coins==1) S=S+L[1];
else if(x-coins==0) S=S+L[2];
coins++;
}
if(coins<N){
if(press(S+"A"+S+"B")>coins){
if(press(S+"A")>coins){
S=S+"A";
}else{
S=S+"B";
}
}else{
if(press(S+"X")>coins){
S=S+"X";
}else{
S=S+"Y";
}
}
}
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |