Basic Basis
Time limit1sMemory limit512 MB
Given n bit vectors of 4k bits, for each of m query vectors find the smallest prefix index i such that some nonempty subset of the first i vectors XORs to the query.
- Level
Hard8 of 10
- Topics
- Math, Bit manipulation, Greedy, Implementation
- Solved
- No attempts yet
Problem
You are given a sequence of bit strings , each with bits.
You are also given another sequence of bit strings , each also with bits.
Let denote the minimum index such that it is possible to take a non-empty subset of , XOR them all together, and get . If there is no such index, .
Print the values .
Input
The first line of input contains three integers (), () and (), where is the length of sequence , is the length of sequence , and the elements of both sequences are bit strings with bits.
Each of the next lines contains a hexadecimal representation of as a string of length . The strings consist only of hexadecimal digits (‘0’–‘9’ and ‘a’–‘f’).
Then, each of the next lines contains a hexadecimal representation of in the same format as above.
Output
Output lines with a single integer on each line, where the integer on the th line is .