#P6779. [Ynoi2009] rla1rmdq
[Ynoi2009] rla1rmdq
Problem Description
You are given a tree with nodes. The tree edges have weights, and there is a sequence of length .
Define the parent of node as . The root satisfies .
Define the depth of node as the sum of all edge weights on the simple path from to the root.
There are operations:
1 l r: For all , set .
2 l r: Query, for all , the minimum value of .
Input Format
The first line contains three integers separated by spaces, where is the index of the root.
Then follow lines, each containing three integers separated by spaces, representing an edge between and with weight .
Then one line contains integers separated by spaces, representing the sequence.
Then follow lines, each containing three integers separated by spaces, representing one operation.
Output Format
For each operation of type , output one line with one integer representing the corresponding answer.
5 6 2
3 2 2
5 3 3
1 2 4
4 2 3
3 3 3 1 2
2 1 1
2 2 3
2 4 5
1 2 3
1 4 4
2 1 2
2
2
0
0
Hint
Idea: yummy, Solution: nzhtl1477&memset0, Code: nzhtl1477, Data: nzhtl1477
Constraints: For of the testdata, , , and edge weights are in .
Translated by ChatGPT 5