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;
char c_list[3];
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];
}
if(N == 1)
return result;
///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];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |