Submission #1282758

#TimeUsernameProblemLanguageResultExecution timeMemory
1282758stefanneaguHiperkocka (COCI21_hiperkocka)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

const int nmax = (1 << 16) + 1;

vector<pair<int, int>> adj[nmax];
int timer = 0;
int to[nmax];

void dfs_init(int i, int tata = -1) {
    for (auto &[it, c] : adj[i]) {
        if (it == tata) {
            continue;
        }
        c = timer++;
        dfs_init(it, i);
    }
}

bool kill = 0;
set<pair<int, int>> viz;
set<pair<int, int>> aux;

void dfs(int i, int val, int tata = -1) {
    for (auto &[it, c] : adj[i]) {
        if (it == tata) {
            continue;
        }
        int v1 = val, v2 = val ^ (1 << c);
        kill |= (viz.find({min(v1, v2), max(v1, v2)}) != viz.end());
        aux.insert({min(v1, v2), max(v1, v2)});
        to[it] = val ^ (1 << c);
        dfs(it, (val ^ (1 << c)), i);
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int a, b;
        cin >> a >> b;
        adj[a].push_back({b, 0});
        adj[b].push_back({a, 0});
    }
    dfs_init(0);
    cout << (1 << (n - 1)) << '\n';
    for (int i = 0; i < (1 << n); i++) {
        kill = 0;
        aux.clear();
        to[0] = i;
        dfs(0, i);
        if (kill) {
            continue;
        }
        for (auto it : aux) {
            viz.insert(it);
        }
        for (int j = 0; j <= n; j++) {
            cout << to[j] << " ";
        }
        cout << '\n';
    }
    return 0;
}

Compilation message (stderr)

Main.cpp:21:6: error: 'bool kill' redeclared as different kind of entity
   21 | bool kill = 0;
      |      ^~~~
In file included from /usr/include/c++/13/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:116,
                 from Main.cpp:1:
/usr/include/signal.h:112:12: note: previous declaration 'int kill(__pid_t, int)'
  112 | extern int kill (__pid_t __pid, int __sig) __THROW;
      |            ^~~~
Main.cpp: In function 'void dfs(int, int, int)':
Main.cpp:31:14: error: invalid operands of types 'int(__pid_t, int) noexcept' {aka 'int(int, int) noexcept'} and 'bool' to binary 'operator|'
   31 |         kill |= (viz.find({min(v1, v2), max(v1, v2)}) != viz.end());
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:31:14: note:   in evaluation of 'operator|=(int(__pid_t, int) noexcept {aka int(int, int) noexcept}, bool)'
Main.cpp: In function 'int32_t main()':
Main.cpp:53:14: error: assignment of function 'int kill(__pid_t, int)'
   53 |         kill = 0;
      |         ~~~~~^~~