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

建议使用的浏览器:

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

5883:The Best Path

题目描述
Alice is planning her travel route in a beautiful valley. In this valley, there are $N$ lakes, and $M$ rivers linking these lakes. Alice wants to start her trip from one lake, and enjoys the landscape by boat. That means she need to set up a path which go through every river exactly once. In addition, Alice has a specific number ($a_1, a_2, ... , a_n$) for each lake. If the path she finds is $P_0 \rightarrow P_1 \rightarrow ... \rightarrow P_t$, the lucky number of this trip would be $a_{P_0} \quad XOR \quad a_{P_1} \quad XOR \quad... \quad XOR \quad a_{P_t}$. She want to make this number as large as possible. Can you help her?
输入解释
The first line of input contains an integer $t$, the number of test cases. $t$ test cases follow.

For each test case, in the first line there are two positive integers $N~(N \leq 100000)$ and $M~(M \leq 500000)$, as described above. The $i$-th line of the next $N$ lines contains an integer $a_i(\forall i, 0 \leq a_i \leq 10000)$ representing the number of the $i$-th lake.

The $i$-th line of the next $M$ lines contains two integers $u_i$ and $v_i$ representing the $i$-th river between the $u_i$-th lake and $v_i$-th lake. It is possible that $u_i=v_i$.
输出解释
For each test cases, output the largest lucky number. If it dose not have any path, output "Impossible".
输入样例
2
3 2
3
4
5
1 2
2 3
4 3
1
2
3
4
1 2
2 3
2 4
输出样例
2
Impossible
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5883

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

共提交 0

通过率 --%
时间上限 内存上限
9000/3000MS(Java/Others) 65535/32768K(Java/Others)