# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
706725 | Username4132 | Hiperkocka (COCI21_hiperkocka) | C++14 | 54 ms | 3608 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<iostream>
#include<vector>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)
#define PB push_back
const int MAXN = 18;
int n, cnt, ret[MAXN];
vector<int> g[MAXN];
void dfs(int v, int p, int cur){
++cnt, ret[v]=cur;
for(int to:g[v]){
if(to==p) continue;
dfs(to, v, cur^(1<<cnt));
}
}
int main(){
scanf("%d", &n);
forn(i, n){
int a, b; scanf("%d %d", &a, &b);
g[a].PB(b), g[b].PB(a);
}
printf("%d\n", 1<<(n-1));
forn(i, 1<<n) if(!(i && (__builtin_popcount(i)&1))){
cnt=-1, dfs(0, 0, i);
forn(j, n+1) printf("%d ", ret[j]);
printf("\n");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |