Codeforces 838B
题目链接: http://codeforces.com/problemset/problem/838/B You are given a directed weighted graph with n nodes and 2 n - 2 edges. The nodes are labeled from 1 to n , while the edges are labeled from 1 to 2 n - 2. The graph's edges can be split into two parts. The first n - 1 edges will form a rooted spanning tree, with node 1 as the root. All these edges will point away from the root. The last n - 1 edges will be from node i to node 1, for all 2 ≤ i ≤ n . You are given q queries. There are two types of queries 1 i w : Change the weight of the i -th edge to w 2 u v : Print the length of the