// 模板题#include <bits/stdc++.h> ; , head[N], dis[N]; ]; int size[N], maxson[N], Root; bool vis[N]; int js[N]; int Answer; int Size; #define gc getchar() inline int read() { ; char c = gc; ') c = gc; + c - ', c = gc; return x; } inline void Add(int u,…