# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299650 | TMJN | Combo (IOI18_combo) | C++17 | 39 ms | 604 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 <bits/stdc++.h>
using namespace std;
const string C[4]={"A","B","X","Y"};
string guess_sequence(int N) {
string S;
int t;
if(press("AB")){
if(press("A")){
t=0;
}
else{
t=1;
}
}
else{
if(press("X")){
t=2;
}
else{
t=3;
}
}
S+=C[t];
if(N==1){
return S;
}
for(int i=1;i<N-1;i++){
string T;
T+=S+C[(t+1)%4]+C[(t+1)%4]+S+C[(t+1)%4]+C[(t+2)%4]+S+C[(t+1)%4]+C[(t+3)%4]+S+C[(t+2)%4];
int k=press(T);
if(k==S.size()){
S+=C[(t+3)%4];
}
else if(k==S.size()+1){
S+=C[(t+2)%4];
}
else{
S+=C[(t+1)%4];
}
}
for(int i=1;i<=2;i++){
string T;
T+=S+C[(t+i)%4];
if(press(T)==N){
return T;
}
}
S+=C[(t+3)%4];
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |