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

建议使用的浏览器:

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

6845:Bitwise Xor

题目描述
Notice:Don't output extra spaces at the end of one line.

Koishi loves bitwise xor!

Satori knows that, so she decides to play a game with Koishi and her $n$ pets. There are $n$ pets standing in a row, and the $i$-th of them has $m_i$ kinds of magic, the $j$-th magic can be described as a pair of non-negative integers$(x_{ij},y_{ij})$. If she use this magic to a non-negative integer $w$, then she can turn $w$ into $w\oplus x_{ij}$ or $w\oplus y_{ij}$ as she wants. addtionally, the $i$-th pet has her favorate integer $p_i$.

Satori's game consists of $q$ rounds. In each round, one of following two things may happan:

1. Koishi closes her third eye, so Satori select one of her pets, and change its favorate integer.

2. Koishi's third eye reopens, so Satori tells three non-negative integers $l,r,x(1\leq l\leq r\leq n)$. Then, pets with index from $l$ to $r$ will use the magic to the integer $x$ one by one($l$-th is the first and $r$-th is the last), every pet \textbf{must} use \textbf{each} of her magic \textbf{exactly once}. After $r$-th pet finishes her operation, integer $x$ will become $y$ at last. Every pet want the final $y$ to be her own favorate integer $p$. so the $i$-th pet will try her best to make $y\oplus p_i$ as small as possible(notice $y$ is the final integer) . Every pet konws any other pets' magic details, favorate integer, and $l,r,x$ in the current round. Suppose they are all the cleverest, what's the final integer $y$?

Koishi is NO.1 all over the world, so she computes the final $y$ easily.

What about you?
输入解释
The first line contains one positive integer $T(1\leq T\leq 15)$, representing $T$ test cases.

In each test case, the first line contains two positive integer $n,q(1\leq n,q\leq 10^5)$, number of pets and rounds.

Following is information of pets. For $i$-th pet, the first line contains two positive integers $m_i,p_i$, the number of magic the $i$-th pet owns and her initial favorate integer. Following are $m_i$ lines. $j$-th of them contains two non-negative integers $x_{ij},y_{ij}$.$(1\leq \sum m_i\leq 10^5,0\leq p,x,y,w< 2^{30})$

Following $q(1\leq q\leq 10^5)$ lines is information of each round. The $i$-th line has two possibilities.

1 x y :means $p_x$ is changed to $y(0\leq y<2^{30})$

2 l r x: means a game with parameters $l,r,x(1\leq l\leq r\leq n,0\leq y<2^{30})$ begins.
输出解释
For each game, output a line with a non-negative integer representing the final $y$ at last of this game.
输入样例
1
5 6
2 11
51 25
33 10
2 26
17 52
10 44
2 30
13 52
46 51
2 16
31 34
44 35
2 34
27 4
47 61
1 4 9
2 1 4 33
1 1 47
2 1 1 47
1 3 41
2 1 3 26
输出样例
30
61
46
来自杭电HDUOJ的附加信息
Recommend IceyWang

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

源链接: HDU-6845

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

共提交 0

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