# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
219986 | Basilhijaz | Combo (IOI18_combo) | C++11 | 1 ms | 256 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>
using namespace std;
string guess_sequence(int N) {
string p = "";
string ans = "";
string opt = "ABXY";
int pos = -1;
for(int i = 0; i < 3; i++){
p = "";
p += opt[i];
if(press(p) == 1){
ans += p;
pos = i;
break;
}
}
if(pos == -1){
pos = 3;
ans += opt[3];
}
string Fopt = "";
for(int i = 0; i < 4; i++){
if(i == pos)continue;
Fopt += opt[i];
}
for(int i = 0; i < N - 2; i++){
p = "";
p += ans; p += Fopt[0]; p += ans; p += Fopt[1]; p += Fopt[1];
p += ans; p += Fopt[1]; p += Fopt[0]; p += ans; p += Fopt[1]; p += Fopt[2];
int num = press(p);
if(num == ans.size()){
ans += Fopt[2];
}
else if(num == ans.size() + 1){
ans += Fopt[0];
}
else{
ans += Fopt[1];
}
}
bool ok = 1;
for(int i = 0; i < 2; i++){
p = "";
p += ans; p += Fopt[i];
if(press(p) == N){
ans += Fopt[i];
ok = 0;
break;
}
}
if(ok){
ans += Fopt[2];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |