T1 thought it was a great God math problems, did not find the law
T2 is the original title, before long, however, and no ideas,
Make every effort to think, time to reduce daze, do not be a problem not to scare
Although continuous bottom, the mentality is still very important, there is no direct correlation between each test, filling it.
T1 prove less likely, DeepinC
T2 "multiplier" "minimum spanning tree"
The longest distance minimum, Unicom is not -1
Otherwise run out minimum spanning tree, then the final ans some on the minimum spanning tree, which is the maximum on the path between two points
Anyway law: if ans is smaller than the tree, and it will replace the piece of tree edge (kruscal algorithm flow) (escape
Then multiply by, find maximum, in fact, the process of seeking lca