This problem is in Contest(s) below:
Contest 1331:最小生成树专题
Contest 1492:最小生成树专题
Contest 1007:MST
Contest 1111:最小生成树和最短路
Contest 1208:最小生成树和最短路
Contest 1497:YC_2021