# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404004 | Nordway | The Xana coup (BOI21_xanadu) | C++17 | 151 ms | 15096 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>
#define pb push_back
using namespace std;
const int N = 1e5 + 1;
const int inf = 1e9;
bool turned[N];
vector <int> g[N];
int dp[N][2][2], tmp[2][2];
void dfs(int v, int p) {
for (int to : g[v]) {
if (to != p) {
dfs(to, v);
}
}
dp[v][turned[v]][0] = 0;
dp[v][turned[v]][1] = inf;
dp[v][1 ^ turned[v]][1] = 1;
dp[v][1 ^ turned[v]][0] = inf;
for (int to : g[v]) {
if (to != p) {
tmp[0][0] = min(tmp[0][0], dp[v][0][0] + dp[to][0][0]);
tmp[0][0] = min(tmp[0][0], dp[v][1][0] + dp[to][0][1]);
tmp[0][1] = min(tmp[0][1], dp[v][0][1] + dp[to][1][0]);
# | 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... |