QOJ.ac

QOJ

حد الوقت: 4 s حد الذاكرة: 1024 MB مجموع النقاط: 100

#11207. 图像识别

الإحصائيات

有 $N$ 张编号为 $0$ 到 $N-1$ 的二值图像。每张图像包含 $M$ 个像素,编号为 $0$ 到 $M-1$。每个像素要么是黑色,要么是白色。任意两张图像至少在一个像素上不同。

现在有一些查询。每个查询包含这些图像的一个子集。对于每个查询,你需要找到一组像素,使得这组像素能够区分该子集中的每一对图像。如果两张图像在给定像素集合中的至少一个像素上取值不同,则称这两张图像可以通过该像素集合区分。所选像素的数量应小于每个查询中图像的数量。

输入格式

输入的第一行包含测试用例的数量 $T$。接下来是 $T$ 个测试用例。

每个测试用例的第一行包含三个整数 $N$、$M$ 和 $Q$,分别表示图像数量、每张图像的像素数量以及查询数量。接下来的 $N$ 行描述每张图像的内容。每行包含一个长度为 $M$ 的 $01$ 字符串,表示图像的内容。接下来的 $Q$ 行描述查询。每个查询以一个整数 $K_i$ 开头,表示该查询中的图像数量,随后是 $K_i$ 个以空格分隔的整数,表示这些图像的索引。

输出格式

对于每个测试用例,输出一行 “Case #x:”,其中 $x$ 是测试用例编号(从 $1$ 开始),随后是 $Q$ 行。每行以一个整数开头,表示区分查询中图像所需的像素数量,随后是该数量的以空格分隔的整数,表示所选像素的索引。每个查询可能有多个答案。只要所选像素的数量小于 $K_i$,你可以输出其中任何一个。

数据范围

  • $1 \le T \le 100$
  • $1 \le N \le 2000$
  • $1 \le M \le 4000$
  • $1 \le Q \le 2000$
  • $1 \le K_i \le N$
  • 所有测试用例中 $N$ 的总和 $\le 2 \times 10^4$
  • 所有测试用例中 $K_i$ 的总和 $\le 5 \times 10^6$

样例

输入 1

1
3 3 4
101
110
001
2 0 1
2 0 2
2 1 2
3 0 1 2

输出 1

Case #1:
1 1
1 0
1 0
2 0 1

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.