# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
322081 | kwongweng | Combo (IOI18_combo) | C++14 | 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 <bits/stdc++.h>
#include "combo.h";
using namespace std;
string guess_sequence(int n){
string S = "";
int a = press("AB");
if (a >= 1){
int b = press("A");
if (b == 1){
S += "A";
}else{
S += "B";
}
}else{
int b = press("X");
if (b == 1) S += "X";
else S += "Y";
}
string c = "ABXY";
string ch = "";
for (int i = 0; i < 4; i++){
if (c[i] == S[0]) continue;
ch += c[i];
}
for (int i = 1; i < n-1; i++){
string ask = S + ch[0] + ch[0] + S + ch[0] + ch[1] + S + ch[0] + ch[2] + S + ch[1];
int b = press(ask);
if (b == i) S += ch[2];
else if (b == i+1) S += ch[1];
else S += ch[0];
}
int b = press(S + ch[0]);
if (b == n) return S + ch[0];
else{
int d = press(S + ch[1]);
if (d == n) return S + ch[1];
else return S + ch[2];
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |