当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

BZOJ3825:[Usaco2014 Dec]Marathon

题目描述

An avid marathon runner herself, Bessie enjoys creating marathon courses for her fellow cows to run. She has most recently designed a route specified by N checkpoints (1 <= N <= 100,000) that must be visited in sequence. Unfortunately, Bessie realizes that the other cows may not have the stamina to run the full route. She therefore wants to know how long certain sub-routes take to run, where a sub-route is a contiguous subsequence of the checkpoints from the full route. To make matters more complicated, Bessie knows that the other cows, being lazy, might choose to skip one checkpoint any time they run a sub-route -- whichever one results in a minimum total travel time. They are not allowed to skip the first or last checkpoints in a sub-route, however. In order to build the best possible marathon course, Bessie wants to investigate the ramifications of making changes to the checkpoint locations in her current course. Please help her determine how certain changes to checkpoint locations will affect the time required to run different sub-routes (taking into account that the cows might choose to omit one checkpoint any time they run a sub-route). Since the course is set in a downtown area with a grid of streets, the distance between two checkpoints at locations (x1, y1) and (x2, y2) is given by |x1-x2| + |y1-y2|.

yjq要被n(n<=100,000)个zhx按顺序吊打,第i个zhx在平面上的坐标为(xi, yi)。

有m(m<=100,000)次操作。
U操作:第i个zhx的位置改为(xnew, ynew)。
Q操作:yjq要被编号从i到j的zhx按顺序吊打,但是yjq可以选择跳过编号在[i+1, j-1]中的一个zhx,问yjq最少要走多远的路。

输入解释
The first line gives N and Q (1 <= Q <= 100,000). The next N lines contain (x, y) locations of N checkpoints in the sequence they must be visited along the route. All coordinates are in the range -1000 .. 1000. The next Q lines consist of updates and queries, one per line, to be processed in the order they are given. Lines will either take the form "U I X Y" or "Q I J". A line of the form "U I X Y" indicates that the location of checkpoint I (1 <= I <= N) is to be changed to location (X, Y). A line of the form "Q I J" asks for the minimum travel time of the sub-route from checkpoint I to checkpoint J (I <= J), given that the cows choose to skip one checkpoint along this sub-route (but not the endpoints I and J).

输出解释
For each sub-route length request, output on a single line the desired length.

输入样例
5 5
-4 4
-5 -3
-1 5
-3 4
0 5
Q 1 5
U 4 0 1
U 4 -1 1
Q 2 4
Q 1 4
输出样例
11
8
8

该题目包含在题集 大视野(八中)OJ 中

题目来源 BZOJ 3825

源链接: LOCAL-BZOJ3825

共提交 0 次

通过率 --%
时间上限 内存上限
10000 MS 128 MB