# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
395376 | KoD | Village (BOI20_village) | C++17 | 170 ms | 22720 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>
template <class T>
using Vec = std::vector<T>;
int main() {
int N;
std::cin >> N;
Vec<Vec<int>> graph(N);
for (int i = 0; i < N - 1; ++i) {
int a, b;
std::cin >> a >> b;
a -= 1;
b -= 1;
graph[a].push_back(b);
graph[b].push_back(a);
}
int min = -1, max = -1;
Vec<int> min_v(N), max_v(N);
// minimum
{
Vec<std::pair<int, int>> use;
auto dfs = [&](auto&& dfs, const int u, const int p) -> bool {
int child = -1;
bool done = false;
for (const int v: graph[u]) {
if (v != p) {
if (dfs(dfs, v, u)) {
done = true;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |