QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 256 MB مجموع النقاط: 100 قابلة للهجوم ✓

#6363. 卡牌游戏

الإحصائيات

Zenyk 和 Marichka 开始玩 Marichka 最喜欢的纸牌游戏。但 Zenyk 甚至忘记了这副牌长什么样。当然,他不能直接去问 Marichka。

他知道这副牌包含 $N$ 张牌。此外,牌有若干种花色,设花色数量为 $K$。每种花色的牌数相同。花色编号从 $1$ 到 $K$。

游戏开始时发了 $M$ 张牌。因此 Zenyk 知道了这些牌的花色。请帮助 Zenyk 判断是否能唯一确定 $K$ 的值。注意,这副牌是合法的,因此至少存在一个合法的 $K$ 值。

输入格式

第一行包含两个整数 $N$ 和 $M$ ($1 \le N \le 10^9$, $1 \le M \le \min(N, 10^5)$)。

第二行包含 $M$ 个整数 $A_i$,表示第 $i$ 张牌的花色 ($1 \le A_i \le N$)。

输出格式

如果能唯一确定花色数量,输出 “YES”,否则输出 “NO”。

样例

样例输入 1

36 11
1 4 2 4 4 2 4 1 4 4 4

样例输出 1

YES

样例输入 2

4 2
1 1

样例输出 2

NO

说明

在第一个测试中,唯一合法的情况是 4 种花色,每种 9 张牌。

在第二个测试中,可能有 1 种或 2 种花色。

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.