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;
string guess_sequence(int n)
{
string ans;
string first_char;
int pom = press("AB");
if(pom >= 1)
{
pom = press("A");
if(pom == 1) first_char = "A";
else first_char = "B";
}
else
{
pom = press("X");
if(pom == 1) first_char = "X";
else first_char = "Y";
}
ans = first_char;
string char1 = "A", char2 = "B", char3 = "X";
if(first_char == "A") char1 = "Y";
if(first_char == "B") char2 = "Y";
if(first_char == "X") char3 = "Y";
int cur_len = 1;
for(int i = 0; i < n-1; i++)
{
pom = press(ans + char1 + ans + char2 + char1 + ans + char2 + char2 + ans + char3 + char3);
if(pom == cur_len+1) ans += char1;
else if(pom == cur_len+2) ans += char2;
else ans += char3;
cur_len++;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |