QOJ.ac

QOJ

Limite de temps : 10 s - 20 s Limite de mémoire : 1024 MB Points totaux : 45

#5944. 围栏

Statistiques

在本题中,你需要求出在 $N \times M$ 的矩形网格($N$ 条水平线段和 $M$ 条垂直线段)上放置石子,以围住至少 $K$ 个交点所需的最少石子数量。如果满足以下任一条件,则称一个交点被围住:

  1. 该点上放置了一颗石子。
  2. 从该点出发,无法仅通过空闲的交点沿网格线到达网格边界上的空闲点。

例如,在 $4 \times 5$ 的网格中围住 $8$ 个点,至少需要 $6$ 颗石子。下图展示了其中一种合法的石子布局,被围住的点用 "x" 标记。

样例

输入格式 1

2
4 5 8
3 5 11

输出格式 1

Case #1: 6
Case #2: 8

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.