# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
513199 | 2022-01-17T04:01:23 Z | fcmalkcin | Hiperkocka (COCI21_hiperkocka) | C++17 | 46 ms | 10632 KB |
/*#pragma GCC optimize("Ofast") #pragma GCC optimization("unroll-loops, no-stack-protector") #pragma GCC target("avx,avx2,fma")*/ #include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define ff first #define ss second #define pb push_back #define endl "\n" #define fff(i,a,b) for (ll i=a;i<=b;i++) mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); const ll maxn=3e5+40; const ll mod=998244353 ; const ll base=317; /// you will be the best but now you just are trash /// goal 5/7 vector<ll> adj[maxn]; ll val[maxn]; ll cnt=-1; void dfs(ll u,ll par,ll nw) { val[u]=nw; for (auto to:adj[u]) { if (to==par) continue; cnt++; dfs(to,u,nw^(1ll<<cnt)); } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if (fopen("t.inp", "r")) { freopen("test.inp", "r", stdin); freopen("test.out", "w", stdout); } ll n; cin>> n; for (int i=1;i<=n;i++) { ll x, y; cin>>x>> y; adj[x].pb(y); adj[y].pb(x); } cout <<(1ll<<(n-1))<<endl; for (int i=0;i<(1ll<<n);i++) { cnt=-1; ll h=__builtin_popcount(i); if (h%2==0) { dfs(0,-1,i); for (int i=0;i<=n;i++) cout <<val[i]<<" "; cout <<endl; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 7244 KB | Output is correct |
2 | Correct | 5 ms | 7372 KB | Output is correct |
3 | Correct | 4 ms | 7324 KB | Output is correct |
4 | Correct | 4 ms | 7372 KB | Output is correct |
5 | Correct | 4 ms | 7372 KB | Output is correct |
6 | Correct | 4 ms | 7372 KB | Output is correct |
7 | Correct | 4 ms | 7348 KB | Output is correct |
8 | Correct | 5 ms | 7372 KB | Output is correct |
9 | Correct | 42 ms | 10608 KB | Output is correct |
10 | Correct | 11 ms | 7620 KB | Output is correct |
11 | Correct | 13 ms | 8008 KB | Output is correct |
12 | Correct | 46 ms | 10540 KB | Output is correct |
13 | Correct | 5 ms | 7372 KB | Output is correct |
14 | Correct | 42 ms | 10632 KB | Output is correct |
15 | Correct | 22 ms | 8744 KB | Output is correct |
16 | Correct | 13 ms | 8012 KB | Output is correct |
17 | Correct | 44 ms | 10540 KB | Output is correct |
18 | Correct | 41 ms | 10632 KB | Output is correct |
19 | Correct | 45 ms | 10540 KB | Output is correct |
20 | Correct | 45 ms | 10560 KB | Output is correct |
21 | Correct | 4 ms | 7372 KB | Output is correct |
22 | Correct | 41 ms | 10620 KB | Output is correct |
23 | Correct | 43 ms | 10596 KB | Output is correct |
24 | Correct | 41 ms | 10604 KB | Output is correct |
25 | Correct | 42 ms | 10564 KB | Output is correct |
26 | Correct | 22 ms | 8768 KB | Output is correct |