# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1022393 | vjudge1 | Hiperkocka (COCI21_hiperkocka) | C++17 | 93 ms | 3708 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;
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |