#AT2086. B - Pasta
B - Pasta
当前没有测试数据。
B - Pasta
Score : $200$ points
Problem Statement
There is pasta consisting of $N$ noodles at Takahashi's home. The length of the $i$-th noodle is $A_i$.
Takahashi has a meal plan for the next $M$ days.
On the $i$-th day, he is going to choose a pasta noodle of length exactly $B_i$ 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
- $1 \leq M \leq N \leq 1000$
- $1 \leq A_i \leq 10^9$
- $1 \leq B_i \leq 10^9$
- 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 $3$-rd noodle on the $1$-st day and the $1$-st noodle on the $2$-nd day, so his meal plan is feasible.
1 1
1000000000
1
No
A noodle of length exactly $1$ is needed.
5 2
1 2 3 4 5
5 5
No
Since there are only $1$ noodle of length $5$, he cannot have a meal on the $2$-nd day.