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"
#define foreach for
#define in :
using namespace std;
typedef long long ll;
const int MODULO = 12;
template<class X , class Y>
bool Maximize(X &x , Y y)
{
if(x < y)
{
x = y;
return true;
}
return false;
}
template<class X ,class Y>
bool Minimize(X &x , Y y)
{
if(x > y)
{
x = y;
return true;
}
return false;
}
template<class X ,class Y>
void Add(X &x , Y y)
{
x += y;
if(x >= MODULO) x-= MODULO;
}
template<class X ,class Y>
void Sub(X & x , Y y)
{
x -= y;
if(x < 0 ) x += MODULO;
}
char dict[] = {'A' , 'B' , 'X' , 'Y'};
string guess_sequence(int n)
{
set<int>lefts;
for(int i = 0 ; i < 4 ; i++)
{
lefts.insert(i);
}
string p = "";
for(int i = 0 ; i < 4 ; i++ )
{
p += dict[i];
if(press(p))
{
lefts.erase(i);
break;
}
p.pop_back();
}
bool rights = true;
int maxx = 1;
while(rights)
{
rights = false;
foreach(int index in lefts)
{
p += dict[index];
if(Maximize(maxx , press(p)))
{
rights = true;
break;
}
p.pop_back();
}
}
while((int)p.size() != n)
{
continue;
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |