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

建议使用的浏览器:

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

7185:Pandaemonium Asphodelos: The First Circle (Savage)

题目描述
Oops, there is something wrong with the Pandaemonium. The friend of Azem, Themis, is just waiting for you to have a look together.

Oh no, rattled Erichthonios, who is the guard of Pandaemonium, misunderstanding you as enemies, starts attacking you. Can you protect yourself and Themis until he calms down?

To simplify the problem, Themis' defending system have $n$ blocks in a line. All the blocks have a initial weight 0 and the same attribute. Erichthonios will perform following 4 kinds of attack $q$ times:

- $1$ $x$ $c$: Erichthonios uses his chain to connect the $x$-th block and all $\bf{closest}$ $2c$ blocks, giving them a new attribute (overlapping the origin atrributes of the blocks).
- $2$ $x$ $y$: Erichthonios copies the attribute of $x$-th block to $y$-th and all $y$-th block's $\bf{nearby}$, $\bf{continuous}$, $\bf{same\ attribute}$, $\bf{longest}$ blocks. (A segment of same attribute blocks containing $y$-th, and the left adjacent block of the segment has a different attribute or is out of boundary, so as right.)
- $3$ $x$ $v$: Erichthonios makes the weight of all the blocks with the same attribute as $x$-th block increase by $v$.
- $4$ $x$: Erichthonios attacks the defending system. Only if you output the weight of the $x$-th block, can you defend it.

Attention: Since you don't know what Erichthonios will do next, there is encoding with the queries. (See the $\bf{input}$)

If you couldn't solve this problem, you will be laughed at by Hythlodaeus later. You don't want to be like that, right?
输入解释
Each test contains multiple test cases. The first line contains the number of test cases $(1 \le T \le 20)$. Description of the test cases follows.

The first line contains two integers $n$ and $q$ ($3\leq n\leq10^8$, $1\leq q\leq 10^5$) -- The number of Themis defending system blocks, and the number of attacks that Erichthonios will perform.

The following $q$ lines contains Erichthonios' attacks, (initially, $last = 0$):

- $1$ $x'$ $c'$: contains 3 integers, $1\leq x'\leq n$, $1 \leq c' \leq \lfloor\frac{n-1}{2}\rfloor$, actually, $x = \big((x' - 1) \oplus last\big) \mod n\ +\ 1$, $c = \big((c' - 1) \oplus last\big) \mod \lfloor\frac{n-1}{2}\rfloor\ +\ 1$.
- $2$ $x'$ $y'$: contains 3 integers, $1\leq x'\leq n$, $1 \leq y' \leq n$, actually, $x = \big((x' - 1) \oplus last\big) \mod n\ +\ 1$, $y = \big((y' - 1) \oplus last\big) \mod n\ +\ 1$.
- $3$ $x'$ $v$: contains 3 integers, $1\leq x'\leq n$, $1 \leq v \leq 10^9$, actually, $x = \big((x' - 1) \oplus last\big) \mod n\ +\ 1$, and there is no encode with $v$, $1 \leq v \leq 10^9$.
- $4$ $x'$: contains 2 integers, $1\leq x'\leq n$, actually, $x = \big((x' - 1) \oplus last\big) \mod n\ +\ 1$, after you get the $Answer$, don't forget to update, $last = Answer\ \text{and}\ 1\ 073\ 741\ 823$.

Where $\oplus$ means bitwise XOR operation, $\text{and}$ means bitwise AND operation.

It is guaranteed that the sum of $n$ does not exceed $2\cdot 10^9$ and the sum of $q$ does not exceed $10^6$
输出解释
For each test case:

For each $4$-th attack, print one integer in a line --- the weight of the block.
输入样例
1
16 12
3 10 16
4 2
1 1 6
1 5 6
1 9 7
1 15 7
2 2 10
2 2 13
3 1 16
4 16
4 9
4 4
输出样例
16
32
32
16
来自杭电HDUOJ的附加信息
Hint The decoded attacks in example:3, x = 10 , v = 164, x = 21, x = 1 , c = 11, x = 5 , c = 11, x = 9 , c = 21, x = 15 , c = 22, x = 2 , y = 102, x = 2 , y = 133, x = 1 , v = 164, x = 164, x = 94, x = 4

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

源链接: HDU-7185

最后修改于 2022-09-15T06:17:13+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 524288/524288K(Java/Others)