# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
444246 | parsabahrami | The Xana coup (BOI21_xanadu) | C++17 | 100 ms | 35144 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.
/* I do it for the glory */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
#define SZ(x) (int) x.size()
#define F first
#define S second
const int N = 1e6 + 10, MOD = 1e9 + 7;
int n, C[N], dp[2][2][N]; vector<int> adj[N]; // [root ro zadim ya na][root akharesh chie][root] :clown:
void DFS(int v, int p = -1) {
if (SZ(adj[v]) < 2 && v > 1) {
dp[0][C[v]][v] = 0;
dp[0][C[v] ^ 1][v] = dp[1][C[v]][v] = MOD;
dp[1][!C[v]][v] = 1;
return;
}
for (int &u : adj[v])
if (u != p) DFS(u, v);
int c = 0, m = MOD;
for (int &u : adj[v]) {
if (u != p) {
if (dp[1][0][u] <= dp[0][0][u])
c++;
m = min(m, abs(dp[1][0][u] - dp[0][0][u]));
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... |