SPOJ375 QUERY ON THE TREE 留坑[树剖]
来源:互联网 发布:js混淆代码后解除混淆 编辑:程序博客网 时间:2024/05/11 17:07
You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3…N-1.
We will ask you to perfrom some instructions of the following form:
CHANGE i ti : change the cost of the i-th edge to ti
or
QUERY a b : ask for the maximum edge cost on the path from node a to node b
Input
The first line of input contains an integer t, the number of test cases (t <= 20). t test cases follow.
For each test case:
In the first line there is an integer N (N <= 10000),
In the next N-1 lines, the i-th line describes the i-th edge: a line with three integers a b c denotes an edge between a, b of cost c (c <= 1000000),
The next lines contain instructions “CHANGE i ti” or “QUERY a b”,
The end of each test case is signified by the string “DONE”.
There is one blank line between successive tests.
Output
For each “QUERY” operation, write one integer representing its result.
Example
Input:
1
3
1 2 1
2 3 2
QUERY 1 2
CHANGE 1 3
QUERY 1 2
DONE
Output:
1
3
题意:在线上的区间求最值树剖模板题;
挑战两次失败,留个坑,有时间再来一次。
- SPOJ375 QUERY ON THE TREE 留坑[树剖]
- [SPOJ375]Query on a tree
- SPOJ375 Query on a tree
- SPOJ375 Query on a tree
- spoj375 Query on a tree
- SPOJ375--Query on a tree(树链剖分)
- spoj375 Query on a tree 树链剖分
- spoj375 Query on a tree 树链剖分
- 【树链剖分】spoj375 Query on a tree
- kyeremal-spoj375-Query on a tree-树链剖分
- SPOJ375 QTREE - Query on a tree
- spoj375 Query on a tree(树链剖分)
- 【SPOJ375】Query on a tree-树链剖分
- 树链剖分+线段树 spoj375 Query on a tree
- 【SPOJ375】 Query on a tree——树链剖分
- Spoj375 Query on a tree 裸·树链剖分
- Spoj375.Query on a tree——树链剖分+线段树(基于边权)
- 【spoj375】Query on a tree【树链剖分】【或者动态树,那样常数就完了T_T】
- 安卓1115_sp存储 生成xml dom sax pull解析
- ACM平方和与立方和
- Codeforces 444C DZY Loves Colors 线段树区间更新
- Null space (零空间)的简单实例分析,参考wiki
- kmp模板
- SPOJ375 QUERY ON THE TREE 留坑[树剖]
- 【Test 2016-10-1】模拟+差分序列+spfa最短路+贪心
- Volley(二) 源码分析
- Eclipse使用技巧总结
- 如何将library项目打包成jar文件
- 修改历史指令条数
- 表达式求值
- c语言 -- 指针和结构体
- Android wear编程与开发(二)