# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
862944 | HataNoKokoro | Combo (IOI18_combo) | C++17 | 0 ms | 0 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.
using namespace std;
string guess_sequence(int N)
{
string result = "";
int coin;
///ask first char
coin = press("AB");
if(coin == 0)
{
c_list[0] = 'A';
c_list[1] = 'B';
result += (press("X") ? 'X' : 'Y');
c_list[2] = (result[0] == 'X' ? 'Y' : 'X');
}
else
{
result += (press("A") ? 'A' : 'B');
c_list[0] = (result[0] == 'A' ? 'B' : 'A');
c_list[1] = 'X';
c_list[2] = 'Y';
}
///ask 2 -> n-1 char
for(int i = 2; i < N; i++)
{
coin = press(result + c_list[0] + c_list[0] + result + c_list[0] + c_list[1]
+result + c_list[0] + c_list[2] + result + c_list[1]);
if(coin == i + 1)
result += c_list[0];
else if(coin == i)
result += c_list[1];
else result += c_list[2];
}
///ask n char
coin = press(result + c_list[0] + result + c_list[1]);
if(coin == N)
return (press(result + c_list[0]) == N ? result + c_list[0] :
result + c_list[1]);
return result + c_list[2];
}