# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
509769 | KoD | Hiperkocka (COCI21_hiperkocka) | C++17 | 165 ms | 43592 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 std::vector;
using std::array;
using std::pair;
using std::tuple;
vector<std::map<int, int>> build(vector<pair<int, int>> edge) {
const int n = edge.size();
if (n == 1) {
std::map<int, int> ret;
const auto& [x, y] = edge[0];
ret[x] = 0;
ret[y] = 1;
return {ret};
}
std::map<int, int> deg;
for (const auto& [x, y] : edge) {
deg[x] += 1;
deg[y] += 1;
}
for (int i = 0; i < n; ++i) {
auto& [x, y] = edge[i];
if (deg[y] == 1) std::swap(x, y);
if (deg[x] == 1) {
std::swap(edge[i], edge[n - 1]);
break;
}
}
const auto [cut, other] = edge[n - 1];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |