#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #define N 40005 #define M 80005 #define LL long long using namespace std; const int INF = 0x3f3f3f3f; int ver[M],edge[M],head[N],Next[M]; int n,m,tot,r…
Tree Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 12276 Accepted: 3886 Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. Give an…
D. Distance in Tree time limit per test 3 seconds memory limit per test 512 megabytes input standard input output standard output A tree is a connected graph that doesn't contain any cycles. The distance between two vertices of a tree is the length (…
Tree Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 24253 Accepted: 8060 Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. Give an…
POJ1741:Tree Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 29574 Accepted: 9915 Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. …