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 <iostream>
#include <vector>
#include "combo.h"
#define endl '\n'
#define ll long long int
using namespace std;
#define BRUTFORCE2
#ifdef BRUTFORCE
string guess_sequence(int N)
{
vector<char> LETTERS = { 'A', 'B', 'X', 'Y' };
string S = ".";
for(auto&& l : LETTERS)
{
S[0] = l;
if(press(S) > 0)
break;
}
for(int i = 1 ; i < N ; ++i)
{
S += ".";
for(auto&& l : LETTERS)
{
if(l == S[0])
continue;
S[i] = l;
if(press(S) == i + 1)
break;
}
}
return S;
}
#endif
/**************************/
#ifdef BRUTFORCE2
string guess_sequence(int N)
{
vector<char> LETTERS = { 'A', 'B', 'X', 'Y' };
string S = ".";
for(auto&& l : LETTERS)
{
S[0] = l;
if(press(S) > 0)
break;
}
for(int i = 1 ; i < N ; ++i)
{
int nb_seen = 0;
S += ".";
for(int j = 0 ; j < int(LETTERS.size()) ; ++j)
{
if(LETTERS[j] == S[0])
continue;
if(nb_seen == 2)
{
if(LETTERS[j] == S[0])
++i;
S[i] = LETTERS[j];
break;
}
S[i] = LETTERS[j];
if(press(S) == i + 1)
break;
nb_seen++;
}
}
return S;
}
#endif
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |