# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1022335 | vjudge1 | Hiperkocka (COCI21_hiperkocka) | C++17 | 639 ms | 3672 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;
int n, path[N];
vector<int> g[N];
vector<pair<int, int>> edges;
void dfs(int v, int p = -1){
for (int e : g[v]){
int u = edges[e].first + edges[e].second - v;
if (u == p) continue;
path[u] = path[v] ^ (1 << e);
dfs(u, v);
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 0; i < n; i ++){
int u, v;
cin >> u >> v;
g[u].push_back(i);
g[v].push_back(i);
edges.push_back({u, v});
}
dfs(0);
cout << (1 << (n - 1)) << endl;
for (int r = 0; r < (1 << n); r ++){
if (__builtin_popcount(r) % 2) continue;
for (int i = 0; i <= n; i ++)
cout << (path[i] ^ r) << endl;
cout << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |