# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1022289 | vjudge1 | Hiperkocka (COCI21_hiperkocka) | C++17 | 76 ms | 3684 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.
#include<bits/stdc++.h>
using namespace std;
const int N = 20;
vector<int> G[N];
int path[N];
int cnt = 0;
void dfs(int v, int p = 0)
{
// cerr << v << ' ' << path[v] << endl;
for(int u : G[v])
if(u != p)
{
path[u] = path[v] ^ (1 << cnt);
cnt++;
dfs(u, v);
}
}
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i ++)
{
int u, v;
cin >> u >> v;
G[u].push_back(v);
G[v].push_back(u);
}
dfs(0);
cout << (1 << (n - 1)) << endl;
for(int mask = 0; mask < (1 << n); mask ++)
{
if(__builtin_popcount(mask) % 2) continue;
for(int i = 0; i <= n; i ++)
cout << (path[i] ^ mask) << ' ';
cout << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |