# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
854919 | dead0ne | Hiperkocka (COCI21_hiperkocka) | C++17 | 41 ms | 5724 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.
#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define spc << " " <<
#define endl "\n"
#define all(x) x.begin(), x.end()
#define ll long long
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 1000000007
#define lim 65540
using namespace std;
vi edges[lim];
vi res(lim);
void place(int num, int node, int par){
res[node]=num;
for(auto i:edges[node]){
if(i==par) continue;
place((num^(1<<(i-1))), i, node);
}
}
void solve(){
int n; cin >> n;
for(int i=1; i<=n; i++){
int a,b; cin >> a >> b;
edges[a].pb(b);
edges[b].pb(a);
}
cout << (1<<(n-1)) << endl;
for(int i=0; i<(1<<n); i++){
if(__builtin_popcount(i)%2) continue;
place(i, 0, 0);
for(int j=0; j<=n; j++) cout << res[j] << " ";
cout << endl;
}
}
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);
#ifdef Local
freopen("in","r",stdin);
freopen("out","w",stdout);
#endif
ll t=1;
//cin >> t;
while(t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |