# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1174532 | Seungni | 콤보 (IOI18_combo) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
string cand = "ABXY";
string s;
string guess(string prefix)
{
string ret = prefix;
ret += s[0];
for (int i = 0; i < 3; i++)
{
ret += prefix;
ret += s[1];
ret += s[i];
}
return ret;
}
string guess_sequence(int N)
{
string S;
string a = "A", b = "B", x = "X";
int aa = press(a), bb = press(b), xx = press(x);
if (aa)
S = a;
else if (bb)
S = b;
else if (xx)
S = x;
else
S = "Y";
char c = S[0];
for (int i = 0; i < 4; i++)
{
if (cand[i] != c)
s += cand[i];
}
for(int i = 0; i < N - 1; i++) {
for(int j = 0; j < 3; j++) {
string now = S + c[j];
int v = press(now);
if(v >= S.length()) {
S += c[j];
break;
}
}
}
return S;
}