Submission #854919

#TimeUsernameProblemLanguageResultExecution timeMemory
854919dead0neHiperkocka (COCI21_hiperkocka)C++17
110 / 110
41 ms5724 KiB
#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 timeMemoryGrader output
Fetching results...