• 沒有找到結果。

Given the location (1, 2) the length of a side of the largest square is 3

N/A
N/A
Protected

Academic year: 2021

Share "Given the location (1, 2) the length of a side of the largest square is 3"

Copied!
2
0
0

加載中.... (立即查看全文)

全文

(1)

10908 Largest Square

Given a rectangular grid of characters you have to find out the length of a side of the largest square such that all the characters of the square are same and the center [intersecting point of the two diagonals]

of the square is at location (r, c). The height and width of the grid is M and N respectively. Upper left corner and lower right corner of the grid will be denoted by (0, 0) and (M− 1, N − 1) respectively.

Consider the grid of characters given below. Given the location (1, 2) the length of a side of the largest square is 3.

abbbaaaaaa abbbaaaaaa abbbaaaaaa aaaaaaaaaa aaaaaaaaaa aaccaaaaaa aaccaaaaaa Input

The input starts with a line containing a single integer T (< 21). This is followed by T test cases. The first line of each of them will contain three integers M , N and Q (< 21) separated by a space where M , N denotes the dimension of the grid. Next follows M lines each containing N characters. Finally, there will be Q lines each containing two integers r and c. The value of M and N will be at most 100.

Output

For each test case in the input produce Q + 1 lines of output. In the first line print the value of M , N and Q in that order separated by single space. In the next Q lines, output the length of a side of the largest square in the corresponding grid for each (r, c) pair in the input.

Sample Input 1

7 10 4 abbbaaaaaa abbbaaaaaa abbbaaaaaa aaaaaaaaaa aaaaaaaaaa aaccaaaaaa aaccaaaaaa 1 2

2 4 4 6 5 2

Sample Output 7 10 4

(2)

Universidad de Valladolid OJ: 10908 – Largest Square 2/2

3 1 5 1

參考文獻

相關文件

If that circle is formed into a square so that the circumference of the original circle and the perimeter of the square are exactly the same, the sides of a pyramid constructed on

好了既然 Z[x] 中的 ideal 不一定是 principle ideal 那麼我們就不能學 Proposition 7.2.11 的方法得到 Z[x] 中的 irreducible element 就是 prime element 了..

volume suppressed mass: (TeV) 2 /M P ∼ 10 −4 eV → mm range can be experimentally tested for any number of extra dimensions - Light U(1) gauge bosons: no derivative couplings. =&gt;

We explicitly saw the dimensional reason for the occurrence of the magnetic catalysis on the basis of the scaling argument. However, the precise form of gap depends

For pedagogical purposes, let us start consideration from a simple one-dimensional (1D) system, where electrons are confined to a chain parallel to the x axis. As it is well known

The observed small neutrino masses strongly suggest the presence of super heavy Majorana neutrinos N. Out-of-thermal equilibrium processes may be easily realized around the

incapable to extract any quantities from QCD, nor to tackle the most interesting physics, namely, the spontaneously chiral symmetry breaking and the color confinement.. 

(1) Determine a hypersurface on which matching condition is given.. (2) Determine a