# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172175 | GioChkhaidze | Hard route (IZhO17_road) | C++14 | 1195 ms | 112860 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>
#define ll long long
#define F first
#define S second
using namespace std;
const int N=5e5+5;
ll n;
vector < ll > v[N];
pair < ll , ll > D[N],T[N],ans;
void Dfs(int x,int p) {
for (int i=0; i<v[x].size(); i++)
if (v[x][i]==p) { swap(v[x][i],v[x][v[x].size()-1]); v[x].pop_back(); break; }
for (int i=0; i<v[x].size(); i++) {
int to=v[x][i];
Dfs(to,x);
if (D[to].F>D[x].F) D[x]=D[to];
else
if (D[to].F==D[x].F) D[x].S+=D[to].S;
}
D[x].F++;
if (!v[x].size()) D[x].S=1;
}
void Ufs(int x) {
pair < ll , ll > M1,M2;
M1.F=M1.S=M2.F=M2.S=0;
M1=D[x],M1.F--;
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... |