atcoder#ABC241B. [ABC241B] Pasta
[ABC241B] Pasta
Score : points
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
.
3 2
1 1 3
3 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.
1 1
1000000000
1
No
A noodle of length exactly is needed.
5 2
1 2 3 4 5
5 5
No
Since there are only noodle of length , he cannot have a meal on the -nd day.