# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
513199 | fcmalkcin | Hiperkocka (COCI21_hiperkocka) | C++17 | 46 ms | 10632 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops, no-stack-protector")
#pragma GCC target("avx,avx2,fma")*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
#define fff(i,a,b) for (ll i=a;i<=b;i++)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const ll maxn=3e5+40;
const ll mod=998244353 ;
const ll base=317;
/// you will be the best but now you just are trash
/// goal 5/7
vector<ll> adj[maxn];
ll val[maxn];
ll cnt=-1;
void dfs(ll u,ll par,ll nw)
{
val[u]=nw;
for (auto to:adj[u])
{
if (to==par) continue;
cnt++;
dfs(to,u,nw^(1ll<<cnt));
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
if (fopen("t.inp", "r"))
{
freopen("test.inp", "r", stdin);
freopen("test.out", "w", stdout);
}
ll n;
cin>> n;
for (int i=1;i<=n;i++)
{
ll x, y;
cin>>x>> y;
adj[x].pb(y);
adj[y].pb(x);
}
cout <<(1ll<<(n-1))<<endl;
for (int i=0;i<(1ll<<n);i++)
{
cnt=-1;
ll h=__builtin_popcount(i);
if (h%2==0)
{
dfs(0,-1,i);
for (int i=0;i<=n;i++) cout <<val[i]<<" ";
cout <<endl;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |