# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1023037 | HishamAlshehri | Combo (IOI18_combo) | C++17 | 28 ms | 1672 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;
string guess_sequence(int N) {
string s = "";
string t = "ABXYABXY";
int c = press("AB");
if (c == 2)
{
s += 'A';
}
else if (c == 1) {
c = press("A");
if(!c)
s += 'B';
else
s += 'A';
}
else
{
c = press("Y");
if (c == 1)
s += 'Y';
else
s += 'X';
}
int idx = 0;
for (int i = 0; i < 4; i++) if (s[0] == t[i]) {idx = i; break;}
char q1 = t[idx + 1], q2 = t[idx + 2], q3 = t[idx + 3];
for (int i = 1; i < N - 1; i++)
{
c = press(s + q1 + s + q2 + q1 + s + q2 + q2 + s + q2 + q3);
if (c == s.size()) s += q3;
else if (c == s.size() + 1) s += q1;
else s += q2;
}
if (N - 1)
{
if (press(s + q1) == N) s += q1;
else if (press(s + q2) == N) s += q2;
else s += q3;
}
// cout << s;
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |