# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107427 | faceless | Mergers (JOI19_mergers) | C++14 | 1722 ms | 136952 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 ll;
const int maxn = 5e5 + 10;
const int maxl = 21;
int cnt, par[maxn][maxl + 2], h[maxn], s[maxn], sz[maxn], psz[maxn], dp[maxn];
vector<int> t[maxn], vec[maxn];
bool pd[maxn];
void DFS(int v){
sz[v] = 1;
for (auto u : t[v]){
if (u != par[v][0]){
DFS(u);
sz[v] += sz[u];
psz[v] += psz[u];
dp[v] += dp[u];
}
}
if (dp[v] == 0 and sz[v] == psz[v] and par[v][0] != -1){
cnt ++;
dp[v] = 1;
pd[v] = 1;
}
}
int lca(int v, int u){
if (h[v] < h[u])
# | 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... |