Online Programming Server

Login

Login with facebook [?]

Facebook

Problem 1104: Find the square II

Problem ID 1104
Title Find the square II
pdf  
Description
You are given a bitmap consisting of '*' and '.'. The task is, determine if the map only consisting one square formed by '*', where other pixels other than the square should be '.'.
Input
The first line contains an integer T . (1 ≤ T ≤ 20), the number of test cases.
The first line of each test cases contains two integers H and W, the height and width of the bitmap. (1 ≤ H, W ≤ 100)
The next H lines each contains W characters describing the map.
Output
For each test cases, if there is exactly one square, output the coordinate and the length of the square. Otherwise, output -1.
Sample Input
4
5 6
......
..**..
..**..
......
......
4 4
....
....
....
....
5 6
..***.
..*.*.
..***.
.*....
.*....
5 5
.....
.***.
.***.
.***.
.....
Sample Output
2 3 2
-1
-1
-1
Hint
 
Last Modified 2012-05-31 19:47:26
Time Limit 1 seconds
Memory Limit 32 MB
Accepted Solutions 0
Submitted Solutions 0
Difficulty Factor 150