# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
855169 | mbfibat | Dynamic Diameter (CEOI19_diameter) | C++17 | 5061 ms | 373696 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>
using namespace std;
#define int long long
typedef pair<int, int> ii;
const int N = 1e5 + 11;
vector<ii> adj[N];
bool is_c[N];
int totChild = 0;
int nChild[N];
int parCentroid[N];
void cal_child(int u, int p = 0) {
nChild[u] = 1;
for (auto [v, w] : adj[u])
if (!is_c[v] && v != p) {
cal_child(v, u);
nChild[u] += nChild[v];
}
}
int find_c(int u, int p = 0) {
for (auto [v, w] : adj[u])
if (v != p && !is_c[v] && nChild[v] > totChild / 2)
return find_c(v, u);
return u;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |