IMGREC1 - Simple Image Recognition

One of the hard problems that borrows human minds and can find the practical application in creating Artifical Intelegence is problem of Image Recognition. This problem in its simplest form can be applied in many spheres of manufactures. In given problem we interest in one elementary case of Image Recognition. You have to make choise form only two possible images that are represented on a bicoloured picture. This images is "dagger" or "zero". This images can be rotated, deformed, scaled, moved, have some noise or different width of lines on the picture. But human always can correctly define that is represented on a picture.

Input

t – number of test cases, than t test cases follows. [t <= 100]
[empty line]
Eache test case starts with integer N equals to number of pictures in this test, than N pictures follows. [4 <= N <= 10]
[empty line]
Description of each picture starts from two integers H and W - height and width of picture accordingly. [5 <= H, W <= 50]
than follows exactly H lines each consists of W chars.
Description of picture consists of two simbols only: 'x' - painted square and '.' - empty square. You can be assured, that no other symbols are present at the description of a picture.

Output

For each test it is necessary to deduce on a separate line a string of chars with length equals to N. The string should consist of a set of two chars 'x' and '0'. Where 'x' corresponds to a dagger on a picture, and '0' corresponds to a zero. If answer will contains other chars or length of a string won't equals to N you will receive status "Wrong Answer".

Score

The score awarded to your program is the sum of scores for individual test cases. The score for individual correctly solved test equals to N (Number of pictures in this test).

Example

Input:
1

5

5 5
x...x
.x.x.
..x..
.x.x.
x...x
5 5
xxxxx
x...x
x...x
x...x
xxxxx
6 6
..x...
..x...
xxxxxx
..x...
..x...
......
5 5
.xxx.
x...x
x...x
x...x
.xxx.
5 5
.xxx.
.x.x.
.xxx.
.....
.....
Output:
x0x00
Output:

You will recieve 5 points for this solution


Added by:Roman Sol
Date:2005-02-09
Time limit:21s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:ZCon 2005

hide comments
2016-10-20 12:24:11
..xxxxx..
.........
..x...x..
.........
..xxxxx..
is it a x or 0
2015-08-25 21:48:10 (Tjandra Satria Gunawan)(曾毅昆)
<a href="http://www.spoj.com/" target="_blank">TEST HTML</a>

Last edit: 2015-08-25 21:48:53
2015-03-17 23:26:11 reggaeguitar
Can you be more clear on what makes a "dagger"?
2014-05-30 06:40:21 Harshit
why am i getting wrong answer , ? my output contains N chars ,0 or x . I also checked by doing output of all 0 N times, still WA . ???
eDIT : nevermind..got it

Last edit: 2014-05-30 06:43:41
2014-02-24 12:24:37 Flago
Could you give information on noise-ratio ?
2012-12-05 02:48:07 Muhammad Rizky Luthfianto
Is this a correct zero?
.x.
x.x
.x.
2012-10-31 22:16:45 Mathan Kumar
I print N characters per test case and no other characters than x and O... Then why WA??
2012-08-05 18:59:08 legrand
is there non x or 0 pictures?
2011-07-24 06:05:44 512_I
can any1 tell me y m getting WA ?
2010-11-17 03:23:41 Sankalp Raghav
Yes!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.