# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
928612 | AtabayRajabli | Combo (IOI18_combo) | C++17 | 13 ms | 1836 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>
std::string guess_sequence(int N)
{
std::string s = "";
std::string t = "ABXY";
int ind = 0;
if(press("AB"))
{
if(press("A"))ind = 0;
else ind = 1;
}
else
{
if(press("X"))ind = 2;
else s = ind = 3;
}
s = t[ind];
t.erase(t.begin() + ind);
for(int i = 1; i < N - 1; i++)
{
std::string c = (s + t[0]) + (s + t[1] + t[0]) + (s + t[1] + t[1]) + (s + t[1] + t[2]);
int p = press(c);
if(p == i + 1)s += t[0];
else if(p == i + 2)s += t[1];
else s += t[2];
}
if(s.size() < N && press(s + "A" + s + "B") == N)
{
if(press(s + "A") == N)s += "A";
else s += "B";
}
else if(s.size() < N)
{
if(press(s + "X") == N)s += "X";
else s += "Y";
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |