QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓

#14218. 狂暴鸡尾酒

Estadísticas

获得“狂乱的鸡尾酒”进度

在《我的世界》(Minecraft)中,玩家可以制作并饮用药水。饮用药水后,会在特定时间内为玩家附加相应的药水效果。“狂乱的鸡尾酒”(A Furious Cocktail)是一个进度的名称,要求玩家同时拥有所有药水效果。这是一项极具挑战性的任务,因为饮用每瓶药水都需要时间,且一次只能饮用一瓶药水。

假设你的背包里有 $N$ 瓶不同的药水,它们的持续时间分别为 $t_1, \dots, t_N$ 秒。假设饮用一瓶药水需要 $T$ 秒,是否可能让所有 $N$ 种药水效果同时生效?请注意,如果某种药水的效果在你刚喝完另一瓶药水的瞬间结束,则不认为这两种药水效果同时生效。

输入格式

第一行包含两个整数 $N$ 和 $T$($0 < N < 1000$ 且 $1 \le T \le 10$),分别表示你背包中的药水数量以及饮用每瓶药水所需的时间(秒)。

接下来的 $N$ 行,每行包含一个整数 $t_i$($1 \le t_i \le 10^6$),表示第 $i$ 瓶药水的持续时间(秒),其中 $i$ 的范围为 $1$ 到 $N$。

输出格式

如果可能让所有 $N$ 种药水效果同时生效,输出 “YES”;否则输出 “NO”。

样例

输入样例 1

5 1
1
2
3
4
5

输出样例 1

YES

输入样例 2

3 2
4
3
2

输出样例 2

NO

输入样例 3

3 2
2
3
5

输出样例 3

YES

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.