P21354 [HackerEarth] You are given an n x n binary matrix A i.e. it contains only 0 and 1.Now you are at A[1][1] and you
普及
题目描述

You are given an n x n binary matrix A i.e. it contains only 0 and 1.Now you are at A[1][1] and you
want to go to an ending point A[k][k]. The only valid moves are: one step right or one step down only
if the block contains 1. You are not allowed to move on a block which contain 0.
Now you have to find the minimum number of moves required to reach A[k][k] from A[1][1]. If it is not possible to
reach at A[k][k] then print ‘-1’.

Constraints:

1 ≤ T ≤10

1 ≤ n ≤100

1 ≤ k ≤ n

A[i][j] = 0 or 1

SAMPLE INPUT
2
5 5
11100
11111
00011
00001
11111
4 4
1111
1111
1111
0000

SAMPLE OUTPUT
8
-1

Explanation

First line is ‘T’ the number of test cases.

First line of each test case contains ‘n’ the size of the matrix and ‘k’.

The next n lines contain the n blocks of each row.

Your output should contain the minimum numbers of moves required. If it is not possible to reach at
A[k][k] then print ‘-1’.

You need to just focus on whether you can reach A[k][k] from A[1][1].

输入格式

见题面

输出格式

见题面

样例输入
12 5 5 11100 11111 00011 00001 11111 4 4 1111 1111 1111 0000 84 47 111100110101100000101100011110001110101111010010101001000111010101110101010010100000 110100001000011000111010001001110101111111111011010110010111000101010101111000101000 001011111001101101011111001101001110000000111001010101001100100011100100110000101110 010000010000010000011001111010011110111001000000000110101000110001011011111011011010 000001010000001101000100001110010011100100101111011001000001000100000010111000100100 011011111001001011000100010000011110010110111010110110111110011110011010001100100111 110101100001001000000000010010101111000100010110110110000001001111101110111110101101 001001111001111100111000011111011111100001100011000001000111000111101110000111011011 101010100010100101100111010100010111111011001011000011111101100110111010110110010010 001100010010001100101010010001000010011010000111111010111111001000001001011100001100 111001011111001101000111011101011101000110010110110110011100101001101001000001011000 011001010110110010111011110010001100101111100111000101000001011001011101011010111101 001000001101101001101110101001001111111000010100011100100000101000111101101111010111 101111000110101011101000100011101010111100110110010010010011101101110011000110101100 001010000110010111001011001111011100001010101111011110000111011011011110000111010110 110111111010101010011110010111100101011110100000101010000011101011110011101111100101 101110000001101000110111001011010101011010000100100111111001000010111000001011101110 000110010011101001111010100111110111110101111011100000000010101100010010101000011011 011110101001100111101011010111100011100000110101110011000011001010000001010001010000 100101000011011111010010110010000010101100001110011000110111110111111001010101111011 100110001011010110101110011110001110101000101101011100101001101011001111000100001111 011111000001110001101101101001100111000000011010100000011101011000010010011010001011 110000110010011111100100100001110011000001111000110000000001000000100111100000001100 100000100110101000110110110000000001111100001101110101110011001101010110010100011001 110110000110010001100110011111100100100101000010101110110011100110110100001000110001 011010000001010011111000011010111001001001001000111111110011011011101001001111101010 000011010110000110011100010110010001101010011000001111110011011011001100101001011100 001000001100001111110010101010000100000110011100011011101000000001001011110001010010 100011011101001111000101000001010111000110111000110000100101010000100011000110101101 111000111111111110011010100001010111100001110011111000010010110011100110001110000100 101000000001011000001110000010010110110100001001000111111111110101000010100000000000 111111000001101100010000101101110101000000110010110110000100011000000011000011000010 010000000010011010110011111001000011111110111000011110010010110111001010010010001011 010011000101000101010010010111000000110100101101000101101110000001000110100010000010 000110110010100110100110010011111100101100010001010101100111001111111001000110011000 110101101011100100011100101110101100110010100111000110100011000000011010010100000011 001011011011010100101111110111010001100000001011000111111100010010100000000111111110 001110011000010010011010101010010011011111110110111010000001001100001110001110111010 100100100011001111101011000101111111100101001011101000100110100011001011101100010110 110101111100000101011101100110101111011101111101110001001011011101110000101010101111 011011100010101100010111100001000101011001111010011001001001100100000010101000011010 110010001011001000010011000001011010011110000000011111011011110011101010000101100111 010110011011101000110100011000100011010110010111000000101010000000001001000101000000 010111100000001111011001001000001001011011010111010001101100100000100001011000111111 001011001010100111010110101110001000101100110101010001101011111011011101111001110011 101110001101000100011111110110000111111101000010001111000101101101110001001001001110 001011101111001011110110011100110011111101001100101110111000111100111001111100110101 100100111011001001100111100111011001011110110010110001110101000100101010000001000100 011001011001111011111110000110111101000001110100011101101110111001001000101011010100 001110111111010000010111110111011110101111000000100111101100001110001110000100110110 100010000111010111111000001110100100000001001010101100110001110100101111111010000111 100110101111110001110011011111001000010100011001111100000011111011110100110010011101 110111001000110010001011010000111110110011010011110001100100001110000001110011101111 001000000011010000011011011100011111101100100110111111010100001101011111101110101111 010011011001101010100001111001100001110010000101110110001110000101010101101011100111 110101111100001011111010100101110101010110110100011000010110000110010001000010010110 101010010001100101001010111111101000111110100111011100110101011110101000011100010100 001011110001010110001111110101101000111101100101101010101000110001010110001011101100 110110100100001110110011111001011100111111110101101000101101011101011110001010010110 100111000110111000011110111100001010110110101100101010110000100011001100110000000101 010001011110011101110101101101101101000011000111010100001111001101001001111000111100 000111010110010101010110001101101110110101100110000011110010000101010000110101011011 100111110100001001010010011111001100011010010101000011110001110100101110110110010101 010111010000010001011010011101010100001011010011000101111001000010011110011101001011 000100001110110011011001101010110000001110011010100000111010001001111001000101001001 000101110010101100000001101101001100011000111001000100000110010000010110101010010001 001010001000101110101010011110010110110010000111001110111000001110101111111111011100 010110001110001110001010111001100100100011111010010111000110101111101110000101100110 010011101010111000010000100011001000010111000101110110110110010110110111110100011001 110101100101011010101111000100011011101101101000010111011000011110011101111011010001 100101100011110011100000101100110101011001010011101001011101111011111001100001101101 000010110011000100000001111001111110101110010101101001110011100011001000001111011111 000001111110011011001011110101001101000011000100000001100110010100010010110110110111 001010011000101100111110100001100011011101110000000011011011000001100010011010000001 100111011011101011010011011001110001110111011010111110010010111110001010101100110101 101100101110101000000010001011010100100110100000100101010111110101101010000010000111 010011001011101000001000010101001010110011011110000101110100000101110100001010010001 110100110000101011001101100001100111110110100000000110010110000010101110000001001001 000011111100110011011111000100010010101001011000101010010011010001010000101011000111 011010111111101101111000001000101000001010100010100110110010000111111010111110011000 011000100101011100011101100000001111100010101011110001101100110101001001011000110010 110001000110010000100000001000111110000011110110001001011111100100100111000010110011 110101000110100111011011000100001010110101111000101110011001001000000010110010001110 111000000101001000011010111000000100100001101000001011000101001011010010100100100001 48 30 100110100110011110111110101010110101001011110000 011001011110001000000101010110101001100000100000 000001100110100010100010000001111111010101100101 101100000001110111010001011001111011111110011000 000010110010000101110011010000001000101100100100 010011000000100011001111100100101110010110101000 100011101111110001110101010110101100001110111110 001001100110000111111000111001001101001110110101 000101010101001000100111101001101000101111000000 010000100000011111101100000000000100100100000101 010100110011001010100110011001100111110011111000 010000101000100110011010001101010011001000010011 010101101110011100001101101110111111101011000110 011101000111100101010011101110011100010001100010 111110100000101010011001011010010101110000010111 100000000101000011110110111101001101100100101100 011110101100000110011001111011010001000010010000 001111001100001100010011010110110011111011010000 011010101110100101110001001001000000010001011011 100000101001010010010010100001101001010100101100 110111011010110010111111001110001000101101110111 100001001110111011111001110101011111011011000110 001101000010101110010011101110100011101100100011 111110000100010001111010100111100010010100100110 001010001010100101110000011000000001001101111110 001001110010000001001100011010011101010010010010 110110110011110000101000001011000011101110000000 111011110011111001111000100100110001011010110010 101111101011001011010111100101100011101000010111 010001101010110111011110111000100000100100111110 011111100001101100110000011100100101011000110100 111110111000100110010110111101110100111010000111 110111100000111001010100100110011000001001100001 000010011100111010110000110110010100101011100010 001001110100011001010101110111101101010110111011 001011100101011100011000111011011110011001110101 110010101010110001100001110100011001011110011011 101001111111111101000101000100110011000111011101 001011011011001100001010001111001101100011011100 100010110001001110000111011001010001010010010111 110001110010011011100100101100010010111110111111 001111100010101101100111111100001110001010000011 101110011101000111110001101100010100011101101110 011011100000000100101010100010001100101101111101 011111101001001111101010111101000001111011111000 001100101010110110000111001111011100100101100110 000011100011010100100111001110110110110111011011 001100000110101001010001101000000110011000001001 5 5 10111 10101 10101 10101 11101 91 6 1101000111110010011011010100000100001110010011110000101111010010110001010011001001011110111 1101001000111110111000011001111011111000011100000100001100111010100100111001101101100010000 0010000100011001100000100000000010110100000100000101101101100011000010010010010101011101101 1000000000010100101000001000101000000000010000010101101001010010011011110110100010110011100 1000011010101001001011100101001001001100100000000100110100010110110001011001100110100010011 1101010011010011111100010000100010110111010011010101100110000001010011010000001011111100000 0000100110100000001000010110101001011010001101100110111100000101000001010100111100101011011 1010110100110110001111010000001101110000001010011000101001001100011110110111100000010110110 0100100010010101001101101111011000110101100111011100000111010110100110100111010001001010111 0100010000110001100101110100001011110111000010000011100110110001111000101110110011101110101 0011100111010100110101000110011011011000110100110100001010000001100011100100110110011100100 1011111000110011101111110011111100010110001000101010001000110100101101001100000101101111100 1111111010011001001100011100101000011111100000000111010110000100101011101011011100001000000 0111010011010001010100100100101010111100100100100100010011001101110110100110001001000001100 1000100011011100111110110010110010010111010111100001010111110110101010110001101101011000111 1011110101111110011101110110000101110110001110110100011000000010101100100001110100101001011 0110111010000000110001100110101110100111111111111011111100100110110101110000001100011100000 0110001000111101100000010010010001110010000110010010101100100100011010100110101100110000010 0011100101001111010101011000110101010100010101111101010010000000001011010011100010101001001 0010001011011000000011010011011100100110011101001000100001111001111100100000100000101101010 1000100000010010010011110011110010100101100011010111011010101110000011101100011001000101110 1111110101100011100101101001011100011011101000110110100010110000000111001001011110100001000 0001111000101110101011010001000100011101110001011001100100100111110100011011101101011011101 1110001111001000001100111100000011001110111001001011000011001001101100110010110011101000100 0101010111101111101100101101000010001010100001110000010100100110110111110010111111101111100 0110100011101101110000001100100101111111001001110011011111100010101110010110111111010001111 1101100010011101011000010010011100110110011111011111101000001100111001000111001110110011011 0010001010011110111100010001011000001000001110001110111010101001111011011110011100100101111 0000111101110001010000100000111011000110000110010010010110111011011001111100100101100110101 1100111110000100100000010100111001010100010001011100101111000100101100101001101011001100101 1110001001100100001100101101000100100100000110100010001111010110100111101110100101000111011 0000101000101011110111111001010100110000010101110101010010100110101111011011000011010010100 1111010000001010010101110110010111010111111000001011000001001000101111000100101010111011111 0110000111001100111101110101011100100110010010001111000110001111001001000001101011001011111 0100101100011010100011010001100010001111010100110111011101011110110010011001011010010100011 0010101011000000101111101011101100110010110001011100000001111001001100100100001111111010111 1100001100000100001110110100011111011100100111111011100110110011010100100011111010100111000 0111101011011000111111111010011000111000101001111000011100000110100010000110101001001101001 0100010100100110011001000101100111000010100110011111010010101000100101110111111100010011111 0110011100010100111001011100010001001111010011000100101010111110000110011100000000111010000 0110010110000100111111000111101110110011011000111000110001111011000001110110101000001001110 1110100000110011110100101100111000010011010111011001101011100000001111010001000111001100011 0110001110100110110001000111100101101110101010011010000011110100100011101000001111111010111 1001101010111100101010001000111111011010000010000100000100101111010011001000000110111111001 1100000011010110110011100111101011111111100110001010101110100010101111001000000001000111000 0010010101110110010010010011011000101110001010011010000001000100010101101001000110010000100 1100100100011110101111101101001101111000011100010101010100001101010011010110111000101110010 1000000011011101111111010000011111111101100000011100001001100011100100011011010100100011101 1010110011000001011101001010110011010110000000110000110010111111000011011110101101110010001 1100100010001111110010000000001100010010000010101011011011110000001111111110111110011110101 1111100011100101010100111101010101011000011001110100101011110100100000101010101101111000111 0110010000100110001100010010010001001101101111101011100100101101111001111011101010100011001 1000111110000011000010011000001101110001000011111110011111110000010010001000101110110101011 0011011001000010011100000101000000101001010011110000010001001011001111110110001010011101000 1010111000111011010000101001001100111000011100000110100100000111100000000000000011111101001 0101000000110110111010100001001111010010101110010111101101111000101110001110011000100011100 0000001111110111100111011000110110111010100011101110011010001110100001101101011101010110110 0001001010111010000001011101100100000111100111111110011010100110101010110001111110110011011 0001000000110110101011111100011000100100111010001100011000001011001001111010110000011011010 1111110010111101001001110101101010110011000111001101011001111101110111111100000111110011110 1000100111010110001110010001010110110100001010010110111001101110001011011111010011001101101 0100100011001010000010101000101101011010100001001101111001010110011111101111011101011111110 1011000111000111100110101100010100000000000001011000001111110000001001001011111111101010111 0110111100000011000100001110001011100000101100001111101010011000111111001111100011101000110 0100011100111001001010010000110100001110011111010101001001000110110111110000111101101000110 1011111000111111100010111101011111000110001100011010011001110101010001001111110000001001100 0111101100110001100000001010011000110100111110100100110011010110111101010111100110101001100 0000110111100011011100101100011011100111001011010101111100111010100110000001100101010001000 1011001111010001100001101100100010110001001001111100010000011110101101000100000010001001000 1111010110000100000000001000000001100000000010011111111111101001110010010011001110000111011 0111011001001011110000110000111101010010100100011000011111101011100100010000000000011100011 1101101001001100110110101001110011101100010000011011001110001100000111110110011110011000010 1000000111111001001011010010000001001001010110100000101010011111010100001010100100101000101 0111101101100001101010011011110111100010011011101100101010100101111111110001111101110111101 1010100001111010111010010101011010001001110010011110011000011110110000111001000101101101100 0110110110101100110010111010101110101100111101110011000110100001110010101011110011111000011 0011101111000011001010100100101100111000010010010110010001001011000110011011010110111111011 1110010101110011000110001010010001000101010011000011000101100101011101001000000000100110110 1010100001000001011011001111000011001001001001110110010011110111001101001111100110101100110 1110111100101110001111110011111000010100100010110001111100011101001001011000011010001111101 1110111111110011000110110001100001111010101000110101010011101011101000100001110100101100000 0011110000101100010010101001101101000100110000011011001101010000110100011000101010110010010 0100011011011011110000100010000001000100101010101100100101101001100100111010000011001011101 0010110110001111110101100111000101100110110100001010110100010000110001011001011011010000011 0111101101100101011010000000110111000010100111010111111100011000110111001011110010101101100 0011101111110101110100011111011110000111000100010000001000101010111110111101010010000000011 0100001010101010000010110111100100000101110001001010000111000000000111010010101000110101001 0010011110000011010000110011110110011110110110011001010001110001001110001000000010111001110 0111110110111110000010101101101110010101110100100101101010100111100110001110100111001110101 1101101010101011100011000110111010100100110011001001101100111110110101110110110011101011010 0000111010000110011100011101111111000111111101010100101010111101001110001000101111101101100 81 30 011110011111110101010001010011100111111000111101000100010111011000010100110010111 101110100101001100110100101010101000110100010101110001001101111011001011010100001 000100110001110111000100010010000010001000101110010101100110010011110010000111000 011101010011000111110000010010001111110110110111100100010011011111000010001000111 001000001001110010101100010101001110010111010010000010001010110001001100001011011 011111010001111010100000111011000110011000111010011011100010110001000100111011100 001111000011011111111000110000000110110111111000001100011001001000010001011101101 111111011111001000011010100010000111011100100011110011001110111100110000011100011 011111000001110001001011101100101010111011110111011010110000010111110010101000101 000111110011001000001001101110010100001001001101110010110101110101101111011100111 110101110001001111000101101110001010001000100001100000110101101100100000011011011 011000110010001011110101001100101011101100000111000010001111100011101011010001111 010010100110111011111000001100001101101111000101111011001111101110000101001111000 101011001101110110100010100000001100100000111100111010000000100011001001110000101 000000010000100000101110101011111011010110100100001110100001100001000010110101001 110110011111011111001010000101010011111000101001101000000101000011000101111011101 011010100000011011001110111010011100111111010111101010100011010100001110010111001 001011000101000000011011000010110010000010010000001101011010001111111110110010010 010111000101010101010110111111110101111100001000101010001111000001010100110110111 010111000111011110110101111000111100000101001110101110101000011111111101101010000 001010110110001110101011011001101000011110110011000101101011101101110101111010110 110101000110000101111100001001010000100111110000101111110110011010010000101100110 001000011010111110011001101110101001000101110111110010100000110000100100011000101 100101001010010001011010111001111011110011011111011110100000100101010011010101000 111011010010000101110011000100100001000001011000101100010000100100000001000100110 001010010100111011000100111010011100101010011111111111100001111001001101100101010 101010000011110010100000010111001101101000111110110110001010010110001101101010011 101101110110001011100100001010001111000001000101101111110011111000101011111111001 010101101010111011110000101001000000010100111010001000010100001001000110110011110 000000000100010111100011001110110001001011010000100000100011110110011110110110110 010000010101110001110101100011010111110100001001111101001101000110011000010110111 001111101000011010011010011000101010000100110111111010011011001111111100001010100 011111010001110011001001100101100111001001110101000000111001101111011111010100010 010101000110001110001110001000111101100111110011011110010111100000110101110111011 100001010101101100110001110011111110011110000100110100010011110001011000000010100 110111110101100111011011010100111110001011011000101000100110100011011101000100010 110000010000000101111011001000001001000000110100011010111111111111001100111001011 010000111111000000111110011010111101111100010010100001000101111011000111110101111 111010010000111011001110100011010110101001010111011110000010011000000100101110110 011111110111000100100010101010001110000101001010010011001101001110000010111100101 110011111010101101000000110000111011100011001000100000001001010011100111011111111 010010010111011101110010011100101110111101000101110100101111100111100110001011100 000010100000010100110010101010010111100110011011001000010010001011101100100001001 110111011011110010000000000101110111011110000011111111000010100111100011001000111 111011010111100010010100000100011110001110001000100110110100111001011000000100010 001010011100010111011001010011010111000111110111111001000010111111111100011000010 100000001011010101011000100000010010000001100110010110110111110110110110101110010 001010011100001011010001110010010110001111011111010100011011010110110001101100000 010011101000111100101001111010011011101011101011100000101100101000110001011110000 001001111101001000100001011001100010101001101011000100000110100101110010100001001 010000011001111000001011101000001001011011101111110101011011011110101000111000001 011110110011011001101110001001000111001010111011101011101001101100001100011100110 001111010100010110010010100111101010001011000110111010000010100101101101011100111 010010011011001010100011101111010010011100000000000001001110001100110000110111111 011111111111101110101110001100001111100001110001101010011101101000111111100100010 010011100010100011110000011010110101010001111111100100001110100110111101011000111 111110001011010001011110011100011100100010111101100011101011011001000101100010100 110000101100000110101011110101010010010100101110010111000000101100101111001111110 101000010000100110111011000110100001000000010000011100000111101101011011100100110 000010001111001110010100100011000001011100010101011001001001001001100011010000001 100000010110010100001100100101111100101110111101101011001000111101111000011100010 110010110111101010010011001000011010100101111010111100100000101010100110001111100 010000010001100110101000111001100101000000110100100101110001111100000011000101111 101010110001100100011110100011110011101101101110111100101100001001011110000011001 111101010100000100111101100000110100010000000101110000110110111100001011011001110 010001111110100100001101011001000111000111100110011101010011111100010100000010111 010111010101000101111101001010111111010001001011111001001101100111000000101000011 100000111001110010101111000101011011100011100100010111011001010111100101011111111 100001010111000111111011100111001011110101000101010100010000100001000011001011111 001010011011110010101001100111010111100001011000010110100110111101001001001101100 001011101110001101011010100011011100010100000101000101111010110000011001001111010 010100001011011010101001011110111000000110011001011101101010010010011000011011111 011101000101100101010011010101000100000111001100001010110100111101011001101111100 001000010101000101001101111001001101111001101111010110101001111001000100010011111 110100000111010010000111110100001011001010001001001010111000000101001101101001101 101100100100110010000111011110000110100110101110110001101010010111100001010011000 100010101100111110110011010101111111111001101010001000010000101110011110000111111 001100101101010011001001000110000110000110011010010111011100100101101110011111010 000111000110100110001100000101000001101110010001101010100110010010111000001011100 101111101110110011111100101001011001111000110111000100111011100100011101010000100 110011111011001000110011011001101100111010110010000101001011101011000001010111101 44 38 11100111111100011010011100100011111100111010 01111001111010010010101110100001110000111011 00010111000111111000110110110001000001101010 10010010101100001011010001001101000011001011 01011110110101100010011101001110111010001110 01001111001011010011100010001001100011111000 10100010110001011110110101010011111111100000 11000101000011111010100111101000100110010110 00111000101011011110101101010010000110000101 01010011000001101011111011010001110110110110 01111010100010111100010111010001110011101100 01010011110001011000100001011001100101001101 00010011111111001010010100111111010001011100 10001111010011011101011001111110010101000110 01110100001110000000111001010111000011101010 01101101011111011101110001011111100000100011 01010101000010100001101101101111000111011011 10110101110000001011000111001110111101101101 10100100101011010011111100111111001011100001 01001000111111100010011000000100001101110011 10100100010011100100111000100010010000100101 01100000110011000000101100101100110111110110 11011010001000100101000010101000101101101100 11010001011010000011000010011010010010111010 01101001001001110000100000100101011011100100 01001000010011010101001010011000100001000001 11000110100000000001001011011001111100010010 11011011101001010001111111011000100111001001 10111110100010000010011101111011000111001010 01111011101110010101100100110001110011001110 11101110011001101111011101110000010111110110 00110000000011000000101010111001111111111101 10110111100001100111000001111100111100110110 01000011011010000001011010011111000101001110 11011011100000111000001001110011111010000000 01111110000011111010101001001001110000000100 01101000010000010001110010011110010010000100 11001011111001010111011001000000100111001111 01010001111101111011010100011101010010101000 11111000101101110100011110011010101101111001 01001111001101011100111110001101001110110011 11001000000100111100001100110001101010110100 11011011000111011011001100001011010111001010 01011101101001000110011001011101001111001100 46 40 0101110010111001001110011011000011100101110010 0101010101110111100000101011011001010000110101 0100100011000011100110111001100010001100000100 0101011100101100110111011110010010111111101111 1001011000110100010111000001100000101011100101 0000110010000100101010100000101100001001001011 1010000100111110000000001100111010011111100010 1001001100000111000011100111101001011101001010 0100011101010011000011010011001001001111100101 1011101111101110010011000100001111101011101010 1111000010110101110010001100011110011010001011 1000010011011010101110100101111001001010110111 1010100000100011010101110100011110000000110111 0110010000100111001001101011100111100100110101 0011110011000101000101101010011011000000000011 1110111010000010101111111100011110101000100111 1010100001001010100101101011000100010010110110 1100011111000001101111110100000111110101000000 1010100110000001110100001011010011011001001101 0100000001011111100111010011110110110101100011 1001010011000001111100001111101011110011110110 0110010001010111000111100000010001001011110001 1000011101000010000101110100111011011111111110 1101010000110000011110001110001011100001010110 1110001100011110111010011101011100111001101010 0011101110011000111100101000001000011110010100 0111011010001100100101110100000000101001111001 0110110000110110010100001110111110100100111101 0000000011101000111011011101100110111010100100 1110101111110000110001011010110000110010101101 1100101011001111111010100001001111100101000111 0110100000101100010010101101001010000010000010 0110100000111110000000110110100001010100111010 1101110000001101101001101011001110111111111010 0001000101100000100011100100110110001011011010 0000111010110100000101111100010000111011010001 0011110101010000101010011100101000101111110101 1110111100000001001100010110011001010100010010 0101010000010000001111001011101111010011010101 1010111010001100011100111011110010011110110010 0111011000010100100111001111101100001000001010 1001111110000111010111101101001101000111001010 1011111010111110001101010010010010101000111011 1110010100100011001100000111100001100111111010 1100000000111100101000101110100010010000011101 1011001000110010000010010011111110000100111110 14 2 01101111100001 11011001110001 11010111010111 01011010110010 01011011001011 01000111100000 01010001111100 11110011110010 11010101110001 10110100101010 00010110011100 01111101010111 10110010101110 00001000100110 7 5 1111100 0000100 0000100 0000100 0000100 0000100 0000100 1 1 1
样例输出
8 -1 -1 -1 -1 -1 -1 -1 -1 -1 8 0