#include "Anna.h"
#include <utility>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace Anna_solver{
const int M=250, BIT=10;
int Declare(){
return M;
}
mt19937 rng(69420);
pair<vector<int>, vector<int>> Anna(long long A){
long long val=uniform_int_distribution<long long>(0, (1ll<<BIT)-1)(rng);
// long long val=0;
A^=val;
vector<int> v;
for (int i=0; i<BIT; ++i){
v.push_back(i&1);
v.push_back(i&1);
v.push_back(i&1);
if (A>>i&1){
// v.push_back(i&1);
v.push_back(i&1);
v.push_back(i&1);
}
}
vector<int> vv;
for (int i=0; i<(int)v.size(); ++i) vv.push_back(i&1);
return {v, vv};
}
}
int Declare() {
return Anna_solver::Declare();
}
std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
return Anna_solver::Anna(A);
}
#include "Bruno.h"
#include <utility>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace Bruno_solver{
const int M=250, BIT=10;
mt19937 rng(69420);
const int L0=3, L1=5;
long long f[M*2+1][BIT+1][BIT+1][2][L1+1];
vector<int> tr[M*2+1][BIT+1][BIT+1][2][L1+1];
int n;
long long Bruno(vector<int> v){
n=v.size();
long long val=uniform_int_distribution<long long>(0, (1ll<<BIT)-1)(rng);
// long long val=0;
long long ans=0;
memset(f, -1, sizeof f);
f[0][0][0][0][0]=0;
for (int i=0; i<n; ++i){
for (int b0=0; b0<=BIT; ++b0){
for (int b1=0; b1<=BIT; ++b1){
for (int k=0; k<2; ++k) for (int l=0; l<L1; ++l) if (f[i][b0][b1][k][l]!=-1){
auto transition=[&](long long &x, long long y, vector<int> &tx, vector<int> &ty){
if (x!=-1 && x!=y){
for (int t=0; t<=i; ++t){
if (find(tx.begin(), tx.end(), t)!=tx.end()) cout << '?';
else cout << v[t];
}
cout << '\n';
for (int t=0; t<=i; ++t){
if (find(ty.begin(), ty.end(), t)!=ty.end()) cout << '?';
else cout << v[t];
}
cout << '\n';
exit(0);
}
assert(x==-1 || x==y);
x=y;
tx=ty;
};
if (v[i]==((i-b0*L0-b1*L1-l)&1)){
transition(f[i+1][b0][b1][k][l], f[i][b0][b1][k][l], tr[i+1][b0][b1][k][l], tr[i][b0][b1][k][l]);
tr[i+1][b0][b1][k][l].push_back(i);
}
if (v[i]==k && l<L1){
transition(f[i+1][b0][b1][k][l+1], f[i][b0][b1][k][l], tr[i+1][b0][b1][k][l+1], tr[i][b0][b1][k][l]);
if (l+1==L0 && b0<BIT){
transition(f[i+1][b0+1][b1][k^1][0], f[i][b0][b1][k][l], tr[i+1][b0+1][b1][k^1][0], tr[i][b0][b1][k][l]);
}
if (l+1==L1 && b1<BIT){
transition(f[i+1][b0][b1+1][k^1][0], f[i][b0][b1][k][l]|(1ll<<(b0+b1)), tr[i+1][b0][b1+1][k^1][0], tr[i][b0][b1][k][l]);
}
}
}
}
}
}
int b1=(n/2-L0*BIT)/(L1-L0), b0=BIT-b1;
assert(b0*L0+b1*L1==n/2);
ans=f[n][b0][b1][0][0];
assert(ans!=-1);
return ans^val;
}
}
long long Bruno(std::vector<int> u) {
return Bruno_solver::Bruno(u);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |