# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
333577 | nicholask | Combo (IOI18_combo) | C++14 | 51 ms | 644 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;
char c[4]={'A','B','X','Y'};
string guess_sequence(int n){
string ans="";
for (int i=1; i<=n; i++){
int fc;
if (i==1){
if (press("AB")){;
if (press("A")){
ans+='A';
fc=0;
} else {
ans+='B';
fc=1;
}
} else {
if (press("X")){
ans+='X';
fc=2;
} else {
ans+='Y';
fc=3;
}
}
continue;
}
if (i==n){
string q=ans;
q+=c[(fc+1)%4];
if (press(q)==n) ans+=c[(fc+1)%4];
else {
q.pop_back();
q+=c[(fc+2)%4];
if (press(q)==n) ans+=c[(fc+2)%4];
else ans+=c[(fc+3)%4];
}
continue;
}
string q="";
q+=ans;
q+=c[(fc+1)%4];
q+=c[(fc+1)%4];
q+=ans;
q+=c[(fc+1)%4];
q+=c[(fc+2)%4];
q+=ans;
q+=c[(fc+1)%4];
q+=c[(fc+3)%4];
q+=ans;
q+=c[(fc+2)%4];
int d=press(q);
if (d==ans.size()+2) ans+=c[(fc+1)%4];
else if (d==ans.size()+1) ans+=c[(fc+2)%4];
else ans+=c[(fc+3)%4];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |