2024年11月19日
摘要: 先通过并查集判断有几个连通图,如果只有一张图,那就用两次dfs/bfs来找到树的直径上的所有端点 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n; 4 vector<int> edges[10005]; 5 bool visited[ 阅读全文
posted @ 2024-11-19 21:12 Coder何 阅读(11) 评论(0) 推荐(0)