Submission #1270491

#TimeUsernameProblemLanguageResultExecution timeMemory
1270491algoproclubHiperkocka (COCI21_hiperkocka)C++20
110 / 110
28 ms3696 KiB
// UUID: 790519c5-0e0d-4ca4-9794-cb10207dd4a0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;


vector<ll>edges[17];
ll h[17];

void dfs(ll x, ll p)
{
	if(x!=0) h[x]=(h[p]^(1<<(x-1)));
	for(auto next:edges[x])
	{
		if(next!=p) dfs(next, x);
	}
}

int main() {
	ll n; cin>>n;

	for(ll i=0; i<n; i++)
	{
		ll a,b;
		cin>>a>>b;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
	dfs(0,0);
	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 timeMemoryGrader output
Fetching results...