# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
735727 | Jeff12345121 | Factories (JOI14_factories) | C++14 | 6103 ms | 178204 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;
typedef long long ll;
vector<vector<pair<int,int>>> g;
int n;
const int nmax = 500005,LOG = 21;
int sz[nmax],is_centroid[nmax],depth[nmax],cp[nmax],mput2[4 * nmax];
ll sol[nmax];
int in_reset[nmax];
long long rdis[nmax];
const ll inf = (1LL << 60);
void get_size(int node, int parent) {
sz[node] = 1;
for (auto k : g[node]) {
if (k.first == parent || is_centroid[k.first]) {
continue;
}
get_size(k.first, node);
sz[node] += sz[k.first];
}
}
int get_centroid(int node, int parent, int nr_nodes) {
int half = nr_nodes / 2;
for (auto k : g[node]) {
if (k.first == parent || is_centroid[k.first]) {
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... |