Submission #62135

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
621352018-07-27 13:36:51FutymyCloneFactories (JOI14_factories)C++14
33 / 100
8087 ms334156 KiB
#include <bits/stdc++.h>
#include "factories.h"
using namespace std;
const int N = 5e5 + 5;
vector <pair <int, int> > g[N];
int h[N], child[N], par[N];
bool visited[N];
long long dist[20][N], ans[N];
void dfs (int u, int p) {
child[u] = 1;
for (auto v: g[u]) {
if (v.first != p && !visited[v.first]) {
dfs(v.first, u);
child[u] += child[v.first];
}
}
}
int findcen (int u, int p, int sz) {
for (auto v: g[u]) {
if (v.first != p && !visited[v.first] && child[v.first] >= sz / 2) return findcen(v.first, u, sz);
}
return u;
}
void redfs (int level, int u, int p, int cost) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...