# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1133485 | sofija6 | Hard route (IZhO17_road) | C++20 | 374 ms | 125220 KiB |
#include <bits/stdc++.h>
#define ll long long
#define MAXN 500010
using namespace std;
ll maxx[MAXN],cnt[MAXN];
vector<ll> G[MAXN];
void DFS_Dist(ll i,ll p)
{
maxx[i]=0;
cnt[i]=1;
for (ll next : G[i])
{
if (next!=p)
{
DFS_Dist(next,i);
if (maxx[next]+1==maxx[i])
cnt[i]+=cnt[next];
else if (maxx[next]+1>maxx[i])
{
maxx[i]=maxx[next]+1;
cnt[i]=cnt[next];
}
}
}
}
bool Cmp(pair<ll,ll> x,pair<ll,ll> y)
{
if (x.first!=y.first)
return x.first>y.first;
return x.second>y.second;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |