#include "bits/stdc++.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #pragma warning(disable:4996) using namespace std; using ld = long double; template using Table = vector>; const ld eps=1e-9; using Graph=vector>; using ll=long long; #define WHATS(var)cout<<__LINE__<<' '<<#var<<"="< ostream& operator <<(ostream &os, const pair v){ os << "( " << v.first << ", " << v.second << ")"; return os; } template ostream& operator <<(ostream &os, const vector &v){ for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os; } template ostream& operator <<(ostream &os, const vector> &v){ for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os; } template ostream& operator <<(ostream &os, const vector> &v){ for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os; } template ostream& operator <<(ostream &os, const set &v){ int i=0; for(auto it:v){ if(i > 0){os << ' ';} os << it; i++; } return os; } // vector>sts(6,vector(2)); void cc(vectorv){ int k=v.size()/3; vector>nums(k); for(int i=0;i>nums(k); for(int i=0;i>N; N--; vector,int>>ps; int now=N; if(N==1){ cout<<-1<=6){ if(now%2==0){ ps.push_back(make_pair(make_pair(now,now/2),0)); }else{ ps.push_back(make_pair(make_pair(now,now/2),1)); flag=!flag; } now=now/2-1; } ps.push_back(make_pair(make_pair(now,0),flag)); vector>vs(ps.size()); for(auto p:ps){ vectorv; if(p.first.first<=5){ for(auto c:sts[p.first.first][p.second]){ if(c=='?')v.push_back(-1); else v.push_back(c-'0'); } }else{ if(p.first.first%2==1){ int aa=0; for(int x=p.first.first;x>p.first.second;--x){ v.push_back(x); v.push_back(x); } v.push_back(p.first.second); for(int x=p.first.first;x>p.first.second;--x){ v.push_back(x); } v.push_back(p.first.second); v.push_back(-1); v.push_back(p.first.second); }else{ for(int x=p.first.first;x>=p.first.second;--x){ v.push_back(x); v.push_back(x); } for(int x=p.first.first;x>=p.first.second;--x){ v.push_back(x); } } } //WHATS(v) vs.push_back(v); } vectoranss; flag=false; for(int i=0;i