# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
261662 | rama_pang | Village (BOI20_village) | C++14 | 188 ms | 26060 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;
const int MAXN = 1e5 + 5;
namespace minimum {
int N;
vector<int> adj[MAXN];
int ans[MAXN];
int dp[MAXN];
int score = 0;
void Dfs(int u, int p) {
for (auto v : adj[u]) if (v != p) {
Dfs(v, u);
if (ans[v] == 0 && ans[u] == 0) {
ans[u] = v;
ans[v] = u;
score += 2;
} else if (ans[v] == 0) {
ans[v] = ans[u];
ans[u] = v;
score += 2;
}
}
if (ans[u] == 0 && p == 0) {
int ch = ans[adj[u][0]];
ans[u] = ch;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |