# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203377 | 0gnjen | Combo (IOI18_combo) | C++14 | 1 ms | 200 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"
std::string guess_sequence(int N)
{
std::string s = "";
int p = press("AB");
if(p > 0)
{
p = press("A");
if(p == 1)
s += 'A';
else
s += 'B';
}
else
{
p = press("X");
if(p == 1)
s += 'X';
else
s += 'B';
}
char c1[4], c[3];
c1[0] = 'A';
c1[1] = 'B';
c1[2] = 'X';
c1[3] = 'Y';
for(int i = 0, j = 0; i < 4; i++)
{
if(c1[i] != s[0])
{
c[j] = c1[i];
j++;
}
}
for(int i = 1; i < N-1; i++)
{
p = press(s+s+c[1]+s+c[2]+c[0]+s+c[2]+c[1]+s+c[2]+s[2]);
if(p == s.size())
{
s += c[0];
}
if(p == s.size()+1)
{
s += c[1];
}
if(p == s.size()+2)
{
s += c[2];
}
}
p = press(s+c[0]);
if(p == N)
{
s += c[0];
}
else
{
p = press(s+c[1]);
if(p == N)
s += c[1];
else
s += c[2];
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |