Submission #1022289

#TimeUsernameProblemLanguageResultExecution timeMemory
1022289vjudge1Hiperkocka (COCI21_hiperkocka)C++17
110 / 110
76 ms3684 KiB
#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 timeMemoryGrader output
Fetching results...