# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
658872 | Foxyy | Hiperkocka (COCI21_hiperkocka) | C++17 | 51 ms | 3660 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Foxyy cin.tie(0); cout.sync_with_stdio(0); cout.tie(0);
struct Solver {
int& n;
vector<vector<int>>& adj;
void solve() {
if (n == 1) {
cout << "1\n";
cout << "0 1\n";
return;
}
vector<int> tree(n+1);
tree[0] = 0;
queue<pair<int, int>> q;
for (int i : adj[0]) {
q.push({i, 0});
}
int cnt = 0;
while (not q.empty()) {
auto [u, p] = q.front();
q.pop();
tree[u] = tree[p] ^ (1 << cnt);
// cerr << u << ' ' << p << ' ' << tree[u] << ' ' << tree[p] << '\n';
cnt++;
for (int v : adj[u]) if (v != p) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |