Submission #1022328

#TimeUsernameProblemLanguageResultExecution timeMemory
1022328vjudge1Hiperkocka (COCI21_hiperkocka)C++17
0 / 110
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; const int N = 20; int n; vector<int> g[N]; vector<pair<int, int>> edges; void dfs(int v, int r, int p = -1){ cout << r << " "; for (int e : g[v]){ int u = edges[e].first + edges[e].second - v; if (u == p) continue; r ^= (1 << e); dfs(u, r, v); r ^= (1 << e); } } 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}); } cout << (1 << (n - 1)) << endl; for (int r = 0; r < (1 << n); r ++){ if (__builtin_popcount(r) % 2) continue; dfs(0, r); cout << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...