# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
394358 | iulia13 | Combo (IOI18_combo) | C++14 | 59 ms | 660 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 <iostream>
#include "combo.h"
using namespace std;
char dani[4] = {'A', 'B', 'X', 'Y'};
string s;
/*string S;
string s;
int N;
int press(string p) {
int len = p.length();
int coins = 0;
for (int i = 0, j = 0; i < len; ++i) {
if (j < N && S[j] == p[i]) {
++j;
} else if (S[0] == p[i]) {
j = 1;
} else {
j = 0;
}
coins = max(coins, j);
}
return coins;
}*/
string guess_sequence(int n)
{
int i;
if (press(s + dani[0] + dani[1]) > 0)
{
if (1 == press(s + dani[0]))
{
s += dani[0];
swap(dani[0], dani[3]);
}
else
{
s += dani[1];
swap(dani[1], dani[3]);
}
}
else
{
if (1 == press(s + dani[2]))
{
s += dani[2];
swap(dani[2], dani[3]);
}
else
s += dani[3];
}
if (n == 1)
return s;
for (i = 2; i < n; i++)
{
int bebic = press(s + dani[0] + s + dani[1] + dani[0] + s + dani[1] + dani[2] + s + dani[1] + dani[1]);
if (bebic == i - 1)
s += dani[2];
else
if (bebic == i)
s += dani[0];
else
s += dani[1];
}
if (press(s + dani[0] + s + dani[1]) >= n)
{
if (n == press(s + dani[0]))
s += dani[0];
else
s += dani[1];
}
else
s += dani[2];
return s;
}/*
int main()
{
cin >> S;
N = S.size();
cout << guess_sequence(N);
return 0;
}*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |