Problem A
10 Kinds of People

The world is made up of
1111000000
1110000011
0111100111
0011111111
Users of binary have to stay in the zones marked with a zero. Users of decimal have to stay in the zones marked with a one. You have to figure out if it is possible for either type of person to get between various locations of interest. People can move north, south, east or west, but cannot move diagonally.
Input
Input starts with a line containing two positive integers,
The next line has an integer
Output
For each query, output binary if a
binary user can start from location
Sample Input 1 | Sample Output 1 |
---|---|
1 4 1100 2 1 1 1 4 1 1 1 1 |
neither decimal |
Sample Input 2 | Sample Output 2 |
---|---|
10 20 11111111111111111111 11000000000000000101 11111111111111110000 11111111111111110000 11000000000000000111 00011111111111111111 00111111111111111111 10000000000000001111 11111111111111111111 11111111111111111111 3 2 3 8 16 8 1 7 3 1 1 10 20 |
binary decimal neither |