Submission #1022393

#TimeUsernameProblemLanguageResultExecution timeMemory
1022393vjudge1Hiperkocka (COCI21_hiperkocka)C++17
110 / 110
93 ms3708 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int const N=17; int const mod=1e9+7; vector<int> adj[N]; int path[N]; int c=0; void dfs(int node,int par=-1){ for(int i:adj[node]){ if(i==par) continue; path[i]=path[node]^(1<<c); c++; dfs(i,node); } } int main(){ int n; cin>>n; for (int i = 0; i < n; ++i) { int u,v; cin>>u>>v; adj[u].push_back(v); adj[v].push_back(u); } dfs(0); cout<<(1<<(n-1))<<endl; for (int b = 0; b < (1<<n); ++b) { if(__builtin_popcount(b) & 1) continue; for (int i = 0; i <=n; ++i) cout<<((path[i])^(b))<<' '; cout<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...