Submission #513199

#TimeUsernameProblemLanguageResultExecution timeMemory
513199fcmalkcinHiperkocka (COCI21_hiperkocka)C++17
110 / 110
46 ms10632 KiB
/*#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 (stderr)

Main.cpp: In function 'int main()':
Main.cpp:45:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |         freopen("test.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:46:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |         freopen("test.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...