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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N)
{
string ans;
array<string, 4> arr = {"A", "X", "Y", "B"};
if(press(arr[0] + arr[1]))
{
if(press(arr[0]))
{
ans += arr[0];
}
else
{
ans += arr[1];
}
}
else
{
if(press(arr[2]))
{
ans += arr[2];
}
else
{
ans += arr[3];
}
}
if(N == 1)
{
return ans;
}
int it = 0;
array<string, 3> temp;
for(int i = 0; i < 4; i++)
{
if(arr[i] == ans)
continue;
temp[it++] = arr[i];
}
for(int i = 0; i < 3; i++)
{
arr[i] = temp[i];
}
for(int i = 1; i < N - 1; i++)
{
int x = press(ans + arr[0] + arr[0] + ans + arr[0] + arr[1] + ans + arr[0] + arr[2] + ans + arr[1]);
if(x == i)
{
ans += arr[2];
}
else if(x == i + 1)
{
ans += arr[1];
}
else
{
ans += arr[0];
}
}
if(press(ans + arr[0]) == N)
{
ans += arr[0];
}
else if(press(ans + arr[1]) == N)
{
ans += arr[1];
}
else
{
ans += arr[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |