The Best Path

TimeLimit:3000MS  MemoryLimit:32768KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

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 → P_1 → ... → P_t, the lucky number of this trip would be a_{P_0}    XOR    a_{P_1}    XOR   ...    XOR    a_{P_t}. She want to make this number as large as possible. Can you help her?

Input

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 ≤ 100000) and M (M ≤ 500000), as described above. The i-th line of the next N lines contains an integer a_i(∀ i, 0 ≤ a_i ≤ 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.

Output
For each test cases, output the largest lucky number. If it dose not have any path, output "Impossible".
SampleInput
2
3 2
3
4
5
1 2
2 3
4 3
1
2
3
4
1 2
2 3
2 4
SampleOutput
2
Impossible
Submit
题目统计信息详细
总AC数6
通过人数4
尝试人数4
总提交量7
AC率57.14%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签
出处

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: