QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 256 MB 總分: 100 可 Hack ✓

#6365. 切蛋糕

统计

今天是 Marichka 的 $k^2$ 岁生日!Zenyk 为此买了一个大蛋糕,现在他想把它切开。

为了简化问题,我们将蛋糕看作一个 $n$ 行 $m$ 列的矩形矩阵。蛋糕上一共有 $k^2$ 根蜡烛,每一根都位于矩阵中唯一的单元格内。Zenyk 想要通过 $k-1$ 条水平切线和 $k-1$ 条垂直切线来切割蛋糕。(注意:他只能在单元格之间进行切割。)切割完成后,得到的 $k^2$ 个部分中,每一部分必须恰好包含一根蜡烛。

你的任务是找到并输出任意一种合法的切割方案,或者指出无法达成目标。

输入格式

第一行包含三个整数 $n, m$ 和 $k$ ($2 \le k \le n, m \le 200$)。接下来的 $n$ 行每行包含一个长度为 $m$ 的字符串。字符 '1' 表示该单元格有一根蜡烛,'0' 表示该单元格没有蜡烛。

保证蛋糕上恰好有 $k^2$ 根蜡烛。

输出格式

如果能够按照 Zenyk 的要求切开蛋糕,第一行输出 "YES",否则输出 "NO"。

如果答案为肯定,第二行必须包含 $k-1$ 个唯一的合法水平切割索引,第三行必须包含 $k-1$ 个唯一的合法垂直切割索引。在第 $i$ 行和第 $i+1$ 行(或列)之间的切割索引为 $i$(从 1 开始计数)。

样例

样例输入 1

4 4 2
1000
0001
0010
0001

样例输出 1

YES
2
3

样例输入 2

3 4 2
1110
0000
0100

样例输出 2

NO

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.