Submission #706725

#TimeUsernameProblemLanguageResultExecution timeMemory
706725Username4132Hiperkocka (COCI21_hiperkocka)C++14
110 / 110
54 ms3608 KiB
#include<iostream> #include<vector> using namespace std; #define forn(i, n) for(int i=0; i<(int)n; ++i) #define PB push_back const int MAXN = 18; int n, cnt, ret[MAXN]; vector<int> g[MAXN]; void dfs(int v, int p, int cur){ ++cnt, ret[v]=cur; for(int to:g[v]){ if(to==p) continue; dfs(to, v, cur^(1<<cnt)); } } int main(){ scanf("%d", &n); forn(i, n){ int a, b; scanf("%d %d", &a, &b); g[a].PB(b), g[b].PB(a); } printf("%d\n", 1<<(n-1)); forn(i, 1<<n) if(!(i && (__builtin_popcount(i)&1))){ cnt=-1, dfs(0, 0, i); forn(j, n+1) printf("%d ", ret[j]); printf("\n"); } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:22:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         int a, b; scanf("%d %d", &a, &b);
      |                   ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...