1260: Treasure

内存限制:512 MB 时间限制:2.500 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:2 通过:0 通过率:0%

题目描述

There are n islands in A, and m bridges(undirected edge) connect these n islands. From any island, you can reach any other island through bridges.
There are infinite treasures on each island, but each treasure on the same island has the same property and the same value. Each property of treasure will appear on up to 10 islands.
There is a warrior who is going to hunt for treasures, starting from the x island, reaching some islands(include x)through bridges and obtaining treasures, but treasures of each property can only be obtained once, that is, if the warrior has reached more than one islands with the same property treasures, he will only choose to collect one of the treasures in these islands.
There is a guard on each bridge. If you want to pass the bridge, you need to pass the test of the guard, that is to say, the combat power of the warrior cannot be less than that of the guard.
In this problem, two events will occur in the A country:
0 x y: Treasures on the x island have increased in value, which means all treasures on this island will
increase in value by y.
1 x y: A warrior with combat power of y sets off from the x island to hunt for treasure. He wants you to
figure out the most value he can get in total.

输入格式

输出格式

For each query, output a line with a positive integer representing the maximum value the warrior has earned.

输入样例 复制

1
5 4 5
1 1 1 2 2
1 2 3 1 2
1 2 1
1 4 3
2 3 1
2 5 2
1 3 1
1 3 2
0 1 5
1 3 1
1 3 2

输出样例 复制

3
5
6
8

分类标签