# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
427230 | keko37 | The Xana coup (BOI21_xanadu) | C++14 | 149 ms | 24340 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;
typedef long long llint;
typedef pair <int, int> pi;
const int MAXN = 100005;
int n;
llint dp[MAXN][2][2], par[MAXN], col[MAXN];
vector <int> v[MAXN];
void dfs (int x, int rod) {
par[x] = rod;
for (auto sus : v[x]) {
if (sus != rod) dfs(sus, x);
}
}
llint calc (int x, int f, int p) {
if (dp[x][f][p] != -1) return dp[x][f][p];
llint res = 1e9;
llint sum = 0, br = 0, mn = 1e9;
for (auto sus : v[x]) {
if (sus == par[x]) continue;
llint a = calc(sus, 0, f);
llint b = calc(sus, 1, f);
sum += min(a, b);
if (b <= a) br ^= 1;
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |