#include <cstdio> #include <iostream> #include <vector> #include <algorithm> using namespace std; #define N 1000 int total=0; int father[N]; int height[N]; struct Edge{ int x; int y; int weight; }; void Init(int n){ for (int i = 1; i <=n ; ++i) { fa...