Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
File size: 1,222 Bytes
718fd53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
You want to write an image detection system that is able to recognize
different geometric shapes. In the first version of the system you settled
with just being able to detect filled squares on a grid.

You are given a grid of **N**×**N** square cells. Each cell is either white or
black. Your task is to detect whether all the black cells form a square shape.

### Input

The first line of the input consists of a single number **T**, the number of
test cases.

Each test case starts with a line containing a single integer **N**. Each of
the subsequent **N** lines contain **N** characters. Each character is either
"." symbolizing a white cell, or "#" symbolizing a black cell. Every test case
contains at least one black cell.

### Output

For each test case **i** numbered from 1 to **T**, output "Case #**i**: ",
followed by YES or NO depending on whether or not all the black cells form a
completely filled square with edges parallel to the grid of cells.

### Constraints

1 ≤ **T** ≤ 20  
1 ≤ **N** ≤ 20

### Example

Test cases 1 and 5 represent valid squares. Case 2 has an extra cell that is
outside of the square. Case 3 shows a square not filled inside. And case 4 is
a rectangle but not a square.