QOJ.ac

QOJ

시간 제한: 1.0 s 메모리 제한: 512 MB 총점: 100 해킹 가능 ✓

#16842. 数组耗尽

통계

在漫长的回家旅途后,兔子 Xeni 决定在她的兔子手机上玩一个游戏。

游戏中的关卡由一个长度为 $n$ 的数组和一个整数 $x$ 描述。在一次操作中,你可以选择数组中相邻的两个和为 $x$ 的元素并将其删除。在此之后,数组的大小将减少 $2$。如果你在进行若干次操作后,数组变为空,则你赢得了该关卡。

当前的关卡对她来说似乎非常困难,她甚至怀疑这个关卡是否可能被通关——毕竟,有可能是游戏制作者没有设计更多的关卡,故意让最后一关无法通过。Xeni 向你寻求帮助——请告诉她是否有可能通关这个游戏。

输入格式

第一行包含两个整数 $n, x$ — 数组的大小以及要删除的元素之和($1 \le n \le 3 \cdot 10^5$,$ -10^9 \le x \le 10^9$)。

第二行包含 $n$ 个整数 $a_i$ — 游戏数组的元素($-10^9 \le a_i \le 10^9$)。

输出格式

如果 Xeni 可以通关,输出 Yes,否则输出 No

样例

输入样例 1

4 10
6 7 3 4

输出样例 1

Yes

输入样例 2

1 7
7

输出样例 2

No

输入样例 3

6 -3
-3 -9 6 3 -6 0

输出样例 3

Yes

输入样例 4

6 4
1 5 2 4 33 0

输出样例 4

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.