# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171637 | mcdx9524 | Hard route (IZhO17_road) | C++14 | 2051 ms | 25028 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 N = 5007;
int n;
vector <int> g[N];
int dep[N];
int root = -1;
map <int, int> cnt;
int mx = -1, mx_cnt = 0;
void pre_dfs(int v, int pr) {
dep[v] = 1;
for (int u : g[v]) {
if (u != pr) {
pre_dfs(u, v);
dep[v] = max(dep[v], dep[u] + 1);
}
}
}
void dfs(int v, int pr, int cur_mx, int cnt_n) {
if ((int) g[v].size() == 1 && v != root) {
cnt[cur_mx * cnt_n]++;
if (cur_mx * cnt_n > mx) {
mx = cur_mx * cnt_n;
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... |