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

建议使用的浏览器:

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

6452:The Kouga Ninja Scrolls

题目描述
The story centres around $n$ rival ninja clans labelled from $1$ to $n$, and $n$ ninjas also labelled from $1$ to $n$.
For each ninja, the family decides his/her initial belief and affiliation of a clan.
But some conflicts occur in the story, such as two young souls, facing the rivalry between their ninjas but falling in love, can change their mind and some ninjas may desert to other opposite clans.

These ninjas are living in a pretty quiet town with straightforward footpaths, but they live like a group of wild animals eyeing up ninjas of other clans, continually escaping and looking forward to killing.
The governor of this region knows that the end of the war between them depends on those ninjas belonging to different clans who have the farthest distance.

That is what a noble vulture as the honest servant of the governor should do.
Now you need to act as a vulture, and report in real time to the governor the largest distance between two ninjas that belong to different clans and whose labels are in a specified consecutive range.
As a practical matter, the distance between two points in the plane is defined as the Manhattan distance, which is equal to the sum of the absolute differences of their Cartesian coordinates.
输入解释
The story centres around $n$ rival ninja clans labelled from $1$ to $n$, and $n$ ninjas also labelled from $1$ to $n$.
For each ninja, the family decides his/her initial belief and affiliation of a clan.
But some conflicts occur in the story, such as two young souls, facing the rivalry between their ninjas but falling in love, can change their mind and some ninjas may desert to other opposite clans.

These ninjas are living in a pretty quiet town with straightforward footpaths, but they live like a group of wild animals eyeing up ninjas of other clans, continually escaping and looking forward to killing.
The governor of this region knows that the end of the war between them depends on those ninjas belonging to different clans who have the farthest distance.

That is what a noble vulture as the honest servant of the governor should do.
Now you need to act as a vulture, and report in real time to the governor the largest distance between two ninjas that belong to different clans and whose labels are in a specified consecutive range.
As a practical matter, the distance between two points in the plane is defined as the Manhattan distance, which is equal to the sum of the absolute differences of their Cartesian coordinates.

$1$ $k$ $x$ $y$, the $k$-th ninja changes his/her position along the direction $(x, y)$; that is to say, he/she moves to the new position $(x_0 + x, y_0 + y)$ where $(x_0, y_0)$ is his/her original position.
$2$ $k$ $c$, the $k$-th ninja changes his/her mind and decides to work for the $c$-th clan.
$3$ $l$ $r$, the governor asks his vulture for ninjas labelled from $l$ to $r$ (inclusive) the largest distance between two of them belonging to different clans.


All $k, x, y, l, r$ and $c$ mentioned in these $m$ lines satisfy $1 \le k, c \le n$, $-10^9 \le x, y \le 10^9$ and $1 \le l \le r \le n$.

We guarantee that the sum of $n$ in all test cases is no larger than $5 \times 10^5$, and the sum of $m$ in all test cases is no larger than $5 \times 10^5$ as well.
输出解释
For each test case, output a line containing "Case #x:" (without quotes) at first, where $x$ is the test case number starting from $1$.

Then for each inquire, output an integer in a line indicating the answer. If all of the related ninjas belong to the same clan, output $0$ instead.
输入样例
1
2 8
0 0 1
1 1 2
3 1 2
1 1 1 1
3 1 2
1 1 1 1
2 1 2
3 1 2
2 1 1
3 1 2
输出样例
Case #1:
2
0
0
2

提示
The Kouga Ninja Scrolls is a historical fantasy novel about ninja written in 1958-1959 by the Japanese author Futaro Yamada.
This is the first volume of the Ninja Scrolls series written by Yamada in 1958-2001.
The book has been translated into English by Geoff Sant and was published by Del Rey in December 2006.

--from Wikipedia, the free encyclopedia

来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6452

最后修改于 2020-10-25T23:31:28+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
12000/12000MS(Java/Others) 262144/262144K(Java/Others)