QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 256 MB Puntuación total: 100

#15733. Frame

Estadísticas

考虑一个大小为 $X \times Y$ 的矩形,其中心挖去了一个 $(X - 2) \times (Y - 2)$ 的矩形。我们称这个图形为大小为 $X \times Y$ 的边框。图 1 展示了大小为 $5 \times 6$ 的边框。

图 1:大小为 5 × 6 的边框

图 2:用 3 × 1 的瓷砖铺满的 5 × 6 边框

假设我们有无限多张大小为 $A \times 1$ 的瓷砖。我们考虑以下问题:是否可以使用这些瓷砖完全铺满一个大小为 $X \times Y$ 的边框(瓷砖可以旋转 90 度)。例如,图 1 中大小为 $5 \times 6$ 的边框可以完全用大小为 $3 \times 1$ 的瓷砖铺满(一种铺法如图 2 所示),但无法用大小为 $4 \times 1$ 的瓷砖铺满。

输入格式

输入的第一行包含两个整数 $X$ 和 $Y$($3 \le X \le 10^6$,$3 \le Y \le 10^6$)。

第二行包含一个整数 $N$,表示需要分析的瓷砖种类数($1 \le N \le 1000$)。

接下来的 $N$ 行,每行包含一个不超过 $10^6$ 的正整数。我们用 $A_k$ 表示输入文件第 $k+2$ 行的整数。

输出格式

输出 $N$ 行,其中第 $k$ 行如果可以使用大小为 $A_k \times 1$ 的瓷砖铺满大小为 $X \times Y$ 的边框,则输出 "YES",否则输出 "NO"。

样例

输入样例 1

5 6
2
3
4

输出样例 1

YES
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.