Submission #1093304

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10933042024-09-26 14:16:34gygDynamic Diameter (CEOI19_diameter)C++17
7 / 100
820 ms478660 KiB
#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);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...