Given two set A and B, each containing various positive integers. You are on the number, line starting from zero. On each odd jumps (the first, third, fifth ...) you can choose a number from set A and jump that distance to your right; on each even jumps (the second, fourth, sixth ...) you can choose a number from set B and jump that distance to your left.
Now given the set A, B, is every integer point on the number line reachable?
The first line contains a number T, indicating the number of testcases.
Each testcase first gives the sets A and B on two lines (First A then B). The first number in the line indicates the number of elements in the set, then follows each of the elements. There will not be duplicate elements in a set.
T <= 100
1 <= number of elements in A or B <= 50000
Each element is no larger than 100000000.
For each testcase, if all points can be reached, output "Win" in a line, otherwise output "Lose".
2 2 8 5 3 6 9 3 3 6 9 12 4 3 9 15 18
Win Lose
Migrated from old NTUJ.
petr
No. | Testdata Range | Score |
---|