# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
90876 | mirbek01 | Hard route (IZhO17_road) | C++11 | 1229 ms | 76668 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;
const int N = 5e5 + 2;
int n, up[N];
vector <int> g[N], roots;
pair <long long, long long> ans, dp[N];
void dfs1(int v, int pr = 0){
dp[v] = {0, 1};
for(int to : g[v]){
if(to == pr)
continue;
dfs1(to, v);
if(dp[to].first + 1 > dp[v].first){
dp[to].first ++;
dp[v] = dp[to];
dp[to].first --;
} else if(dp[to].first + 1 == dp[v].first){
dp[v].second += dp[to].second;
}
}
}
void dfs2(int v, int pr = 0){
pair <int, int> mx[2];
mx[0].first = mx[1].first = -1;
if(up[v] > mx[0].first)
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... |