# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1093304 | gyg | Dynamic Diameter (CEOI19_diameter) | C++17 | 820 ms | 478660 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
#define arr array
#define vct vector
#define pii pair<int, int>
#define fir first
#define sec second
#define hmap unordered_map
#define prq priority_queue
const int MX_N = 1e5 + 5;
int n, q, w;
arr<arr<int, 3>, MX_N> edg;
arr<vct<pii>, MX_N> adj; // Weights are original
arr<bool, MX_N> dltd;
arr<int, MX_N> sz;
void cmp_szs(int u, int pr = -1) {
sz[u] = 1;
for (pii x : adj[u]) {
if (dltd[x.fir] || x.fir == pr) continue;
cmp_szs(x.fir, u);
sz[u] += sz[x.fir];
}
}
int gt_cnt(int u, int wh_sz, int pr = -1) {
for (pii x : adj[u]) {
if (dltd[x.fir] || x.fir == pr) continue;
if (2 * sz[x.fir] > wh_sz) return gt_cnt(x.fir, wh_sz, 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... |