Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

Problem hidden on 2015-09-08 12:00:44 by kuszi

MUDDY - Muddy Fields


Rain has pummeled on the cows' field, a rectangular grid of R rows and C columns (1 <= R <= 50, 1 <= C <= 50). While good for the grass, the rain makes some patches of bare earth quite muddy. The cows, being meticulous grazers, don't want to get their hooves dirty while they eat.

To prevent those muddy hooves, Farmer John will place a number of wooden boards over the muddy parts of the cows' field. Each of the boards is 1 unit wide, and can be any length long. Each board must be aligned parallel to one of the sides of the field.

Farmer John wishes to minimize the number of boards needed to cover the muddy spots, some of which might require more than one board to cover. The boards may not cover any grass and deprive the cows of grazing area but they can overlap each other.

Compute the minimum number of boards FJ requires to cover all the mud in the field.

Input

t – the number of test cases, then t test cases follows.
Each test case is of the following form:
Two space-separated integers: R and C, then R lines follows
Each line contains a string of C characters, with '*' representing a muddy patch, and '.' representing a grassy patch. No spaces are present.

Output

For each test case output a single integer representing the number of boards FJ needs.

Example

Input:
1
4 4
*.*.
.***
***.
..*.

Output:
4

Output details:
Boards 1, 2, 3 and 4 are placed as follows:
1.2.
.333
444.
..2.
Board 2 overlaps boards 3 and 4.

hide comments
yaswanth: 2014-07-26 10:53:53

AC :)

Rocker3011: 2014-07-18 00:40:30

took me a long time to solve this problem only cause i had many issues constructing the graph >:d, great problem! although i found some solutions accepted that are SO WRONG, they do the algorithm with nodes that do self loops and they got ACed not good at all

Altamir Gomes Bispo Junior [UFSCar]: 2014-03-01 11:08:58

It's 2 because the boards aren't allowed to cover any of the grass.

hossamyosef: 2013-06-29 03:45:00

Lewin Gan , it must be 1 !

devu: 2013-06-01 21:28:18

Don't put problems at spoj if you cannot make your test data tough. Your problem accepts a wrong solution also.

sandipan: 2012-05-13 10:22:49

Give some test cases more!
Getting WA.

Lewin Gan: 2010-05-23 03:27:40

2

fantastic: 2010-05-17 13:01:16

1 3
*.*
is 1 or 2 ?.


Added by:Roman Sol
Date:2005-01-19
Time limit:5s
Source limit:30000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:USACO January 2005 Gold Division