# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
894256 | box | The Xana coup (BOI21_xanadu) | C++17 | 69 ms | 20092 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;
#define ar array
#define sz(v) static_cast<int>(v.size())
#define all(v) (v).begin(), (v).end()
typedef pair<int, int> pi;
typedef long long ll;
typedef vector<int> vi;
const int N = 1e5, INF = 1e9;
int n, a[N];
ar<int, 2> dp[N][2];
vi g[N];
ar<int, 2> operator+(const ar<int, 2> &u, const ar<int, 2> &v) {
return {min({INF, u[0] + v[0], u[1] + v[1]}),
min({INF, u[0] + v[1], u[1] + v[0]})};
}
void dfs(int p, int i) {
ar<int, 2> op0{0, INF}, op1{INF, 1};
for (int j : g[i])
if (p ^ j) {
dfs(i, j);
op0 = op0 + dp[j][0];
op1 = op1 + dp[j][1];
}
if (a[i]) {
# | 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... |