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;
std::string guess_sequence(int n)
{
vector<string> cont;
string seq = "";
for (auto c : {"A", "B", "X", "Y"})
if (press(c))
{
seq += c;
break;
}
for (auto c : {"A", "B", "X", "Y"})
if (c != seq)
cont.push_back(c);
for (int i = 1; i < n - 1; i++)
{
string cpress = seq + cont[0] + seq + cont[1] + cont[0] + seq + cont[1] + cont[1] + seq + cont[1] + cont[2];
int cur = press(cpress) - i;
if(cur == 1)
seq += cont[0];
else if(cur == 2)
seq += cont[1];
else
seq += cont[2];
}
for(auto c:cont)
if(press(seq + c) == n)
seq += c;
return seq;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |