#abc241b. B - Pasta
B - Pasta
Score : points
问题描述
在高桥家有 根意面,第 根意面的长度为 。
高桥为接下来的 天制定了一个用餐计划。在第 天,他打算选择一根长度恰好为 的意面食用。如果在任何一天都没有这样的意面可供选择,则他的计划失败。另外,他不能在多天内吃同一根意面。
高桥能否完成他的用餐计划呢?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There is pasta consisting of noodles at Takahashi's home. The length of the -th noodle is .
Takahashi has a meal plan for the next days. On the -th day, he is going to choose a pasta noodle of length exactly and eat it. If no such noodle is available on any day, his plan fails. Additionally, he cannot eat the same noodle on multiple days.
Can Takahashi accomplish his meal plan?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If Takahashi can accomplish his meal plan, print Yes
; otherwise, print No
.
Sample Input 1
3 2
1 1 3
3 1
Sample Output 1
Yes
He can eat the -rd noodle on the -st day and the -st noodle on the -nd day, so his meal plan is feasible.
Sample Input 2
1 1
1000000000
1
Sample Output 2
No
A noodle of length exactly is needed.
Sample Input 3
5 2
1 2 3 4 5
5 5
Sample Output 3
No
Since there are only noodle of length , he cannot have a meal on the -nd day.
update @ 2024/3/10 10:22:57