[CodeForces1000]G. Two-Paths
作为压轴题,题目描述很长、很难理解。
还没写好 QwQ
G. Two-Paths
You are given a weighted tree (undirected connected graph with no cycles, loops or multiple edges) with
Let’s call a path starting in vertex
For some 2-path
You are about to answer
Input
The first line contains two integers
The second line contains
Next
Next
Output
For each query print one integer per line — maximal profit
Example
input
7 66 5 5 3 2 1 21 2 22 3 22 4 14 5 16 4 27 3 251 14 45 66 43 43 7
output
999812-14
Note
Explanation of queries:
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main(void){ printf("还没写好 QwQ\n"); return 0;}