// UUID: 933f3602-8378-4284-b5de-d248aadafd18
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<pair<ll,ll>>edges;
ll h[17];
int main() {
ll n; cin>>n;
for(ll i=0; i<n; i++)
{
ll a,b;
cin>>a>>b;
if(a>b)swap(a,b);
edges.push_back({a,b});
}
sort(edges.begin(), edges.end());
for(ll i=0; i<n; i++)
{
auto[a,b]=edges[i];
h[b]=(h[a]^(1<<(b-1)));
}
cout<<(1<<(n-1))<<endl;
for(ll i=0; i<(1<<n); i++)
{
if((__builtin_popcount(i)%2)==0)
{
for(ll j=0; j<=n; j++)
{
cout<<(h[j]^i)<<" ";
}cout<<"\n";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |