QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 50

#13370. 估算马拉松

Statistics

Paula 和 Domagoj 正在组织一场名为 Estimathon 的激动人心的团队竞赛。他们已经准备好了题目,现在正在布置竞赛场地。

还没等你反应过来,Domagoj 已经在房间里摆好了 $n$ 张桌子。现在他们需要添加椅子。这些椅子颜色非常丰富,共有 $m$ 种颜色,其中第 $i$ 种颜色的椅子有 $a_i$ 把。每个团队由四个人组成。因此,对于每张桌子,Paula 和 Domagoj 需要放置四把椅子。他们希望房间看起来尽可能美观。为了实现这一点,他们约定了以下条件:

  • 每张桌子上的椅子颜色必须相同。
  • 每种颜色的椅子都必须被使用,也就是说,对于每种颜色,至少存在一张桌子放置了该颜色的椅子。

由于太在意房间的美观程度,他们突然意识到比赛马上就要开始了!请帮他们判断是否有可能在满足上述条件的情况下安排这些椅子。

输入格式

第一行包含整数 $n$ 和 $m$ ($1 \le n, m \le 100$),分别表示桌子的数量和椅子颜色的数量。

第二行包含 $m$ 个整数 $a_i$ ($1 \le a_i \le 100$),其中第 $i$ 个数表示第 $i$ 种颜色的椅子数量。

输出格式

在唯一的一行中输出 DA(如果可以满足上述两个条件),否则输出 NE

子任务

子任务 分值 约束
1 11 $a_1 = \dots = a_m = 4$
2 39 无额外约束。

样例

输入格式 1

7 3
5 21 9

输出格式 1

DA

输入格式 2

5 4
8 5 10 3

输出格式 2

NE

说明

第二个样例的解释:我们可以摆放 5 张放有同色椅子的桌子,但我们无法摆放一张颜色为 4 的桌子,因此第二个条件无法满足。

输入格式 3

6 5
5 5 5 5 5

输出格式 3

NE

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.