QOJ.ac

QOJ

Süre Sınırı: 1 s Bellek Sınırı: 256 MB Toplam puan: 100 Hack'lenebilir ✓

#18968. Pixel 8

İstatistikler

Given an $n \times m$ matrix consisting of 0 and 1, representing a pixel image. You need to determine whether this pixel image forms the digit "8".

The pixel image represents the digit "8" if and only if both of the following conditions hold:

  1. All pixels with value 1 form exactly one 4-connected component.

  2. Inside that connected component of 1s, there are exactly two "holes".

Here, a "hole" is defined as a 4-connected component of 0s that satisfies:

  • The component is completely surrounded by 1s (that is, all pixels adjacent to it from outside are 1s), and it does not touch the boundary of the matrix.

Note: Two pixels are adjacent in the 4-connected sense if and only if they are adjacent in one of the four directions: up, down, left, or right.

Input

The first line contains two positive integers $n,m$ $(1\le n,m\le 1000)$.

The next $n$ lines each contain $m$ integers, each either 0 or 1, describing the matrix.

Output

If the matrix is "8", output a single line containing the string This is eight. (without quotes).

If the matrix is not "8", output a single line containing the string I don't know what this number is. (without quotes).

Examples

Input 1

9 5
0 1 1 1 0
1 1 0 1 1
1 0 0 0 1
1 1 0 1 1
0 1 1 1 0
1 1 0 1 1
1 0 0 0 1
1 1 0 1 1
0 1 1 1 0

Output 1

This is eight.

Input 2

5 3
1 1 1
1 0 1
0 1 0
1 0 1
1 1 1

Output 2

I don't know what this number is.

Input 3

7 7
1 1 1 1 1 1 1
1 0 0 0 0 0 1
1 0 1 1 1 0 1
1 0 1 0 1 1 1
1 0 1 1 1 0 1
1 0 0 0 0 0 1
1 1 1 1 1 1 1

Output 3

This is eight.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.