# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
916725 | andrei_iorgulescu | Combo (IOI18_combo) | C++14 | 14 ms | 2052 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)
{
char firstc;
int x = press("AB");
if (x == 0)
{
int y = press("X");
if (y == 0)
firstc = 'Y';
else
firstc = 'X';
}
else
{
int y = press("A");
if (y == 0)
firstc = 'B';
else
firstc = 'A';
}
if (N == 1)
{
string ret;
ret.push_back(firstc);
return ret;
}
string restul;
if (firstc == 'A')
restul = "BXY";
else if (firstc == 'B')
restul = "AXY";
else if (firstc == 'X')
restul = "ABY";
else
restul = "ABX";
string ans;
ans.push_back(firstc);
for (int i = 2; i < N; i++)
{
///restul[0] deloc, restul[1] singur, restul[2] cu orice dupa
string idfk;
string s1,s2,s3,s4;
s1 = ans + restul[1];
s2 = ans + restul[2] + restul[0];
s3 = ans + restul[2] + restul[1];
s4 = ans + restul[2] + restul[2];
idfk = s1 + s2 + s3 + s4;
int idk = press(idfk);
if (idk == ans.size())
ans.push_back(restul[0]);
else if (idk == ans.size() + 1)
ans.push_back(restul[1]);
else
ans.push_back(restul[2]);
}
for (int i = 0; i < 2; i++)
{
string idfk;
idfk = ans + restul[i];
int idk = press(idfk);
if (idk == N)
return idfk;
}
string idfk = ans + restul[2];
return idfk;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |