将所有节点的子节点从小到大排序,在选择的时候只会更长,且字典序最小的更新。 #includebits/stdc++.husing namespace std;const int N = 10010;vectorint g[N]; bo....