QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#18968. 像素8

Statistics

给定一个由 01 组成的 $n \times m$ 矩阵,表示一张像素图。你需要判断该像素图是否构成数字 "8"。

当且仅当满足以下两个条件时,认为该像素图表示数字 "8":

  1. 所有值为 1 的像素点恰好构成 一个 四连通块。

  2. 在该 1 的连通块内部,恰好存在 两个"洞"

    其中,"洞"定义为满足以下条件的 0 的四连通块:

    • 该连通块被 1 完全包围(即其所有相邻的外部像素均为 1)且均不与矩阵边界接触。

说明: 两个像素点在四连通意义下相邻,当且仅当它们在上下左右四个方向之一相邻。

Input

第一行两个正整数 $n,m$ $(1\le n,m\le 1000)$。

接下来 $n$ 行,每行 $m$ 个值为 01 的整数,描述这个矩阵。

Output

如果这个矩阵是"8",输出一行一个字符串"This is eight."(不包含引号)。

如果这个矩阵不是"8",输出一行一个字符串"I don't know what this number is."(不包含引号)。

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.