# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62135 | FutymyClone | Factories (JOI14_factories) | C++14 | 8087 ms | 334156 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>
#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) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |