# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
853312 | overwatch9 | Village (BOI20_village) | C++17 | 83 ms | 18628 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 <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
using ll = long long;
const int maxn = 1e5 + 1;
vector <int> adj[maxn];
vector <int> min_path_nodes;
pair <int, bool> dfs(int s, int p, int d) {
pair <int, bool> ans = {0, false};
for (auto i : adj[s]) {
if (i == p)
continue;
auto res = dfs(i, s, d+1);
if (!res.second) {
ans.second = true;
ans.first += 2;
swap(min_path_nodes[s], min_path_nodes[i]);
}
ans.first += res.first;
}
return ans;
}
int sz[maxn];
vector <int> ord;
void dfs2(int s, int p) {
ord.push_back(s);
sz[s] = 1;
for (auto i : adj[s]) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |