Submission #1022386

# Submission time Handle Problem Language Result Execution time Memory
1022386 2024-07-13T12:35:26 Z vjudge1 Hiperkocka (COCI21_hiperkocka) C++17
0 / 110
0 ms 344 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
int const N=18;
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;
        c++;
        path[i]=path[node]^(1<<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)%2)
            continue;
        for (int i = 0; i <=n; ++i)
            cout<<((path[i])^(b))<<' ';
        cout<<endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Integer 6 violates the range [0, 3]
2 Halted 0 ms 0 KB -