#abc252b. B - Takahashi's Failure

B - Takahashi's Failure

Score : 200200 points

问题描述

Takahashi 家中有 NN 种食物。第 ii 种食物的美味度为 AiA_i。 他不喜欢其中的 KK 种食物:对于每个 i=1,2,,Ki=1,2,\ldots,K,他都不喜欢第 BiB_i 种食物。

NN 种食物中,Takahashi 将随机选择美味度最高的那一种来吃。 如果他有可能吃到自己不喜欢的食物,请输出 Yes;否则,输出 No

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Takahashi has NN foods in his house. The ii-th food has the tastiness of AiA_i.
He dislikes KK of these foods: for each i=1,2,,Ki=1,2,\ldots,K, he dislikes the BiB_i-th food.

Out of the foods with the greatest tastiness among the NN foods, Takahashi will randomly choose one and eat it.
If he has a chance to eat something he dislikes, print Yes; otherwise, print No.

Constraints

  • 1KN1001\leq K\leq N\leq 100
  • 1Ai1001\leq A_i\leq 100
  • 1BiN1\leq B_i\leq N
  • All BiB_i are distinct.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN KK

A1A_1 A2A_2 \ldots ANA_N

B1B_1 B2B_2 \ldots BKB_K

Output

If Takahashi has a chance to eat a food he dislikes, print Yes; otherwise, print No.

Sample Input 1

5 3
6 8 10 7 10
2 3 4

Sample Output 1

Yes

Among the five foods, the ones with the greatest tastiness are Food 33 and 55, of which he eats one.
He dislikes Food 22, 33, and 44, one of which he has a chance to eat: Food 33.
Therefore, the answer is Yes.

Sample Input 2

5 2
100 100 100 1 1
5 4

Sample Output 2

No

The foods with the greatest tastiness are Food 11, 22, and 33, none of which he has a chance to eat.

Sample Input 3

2 1
100 1
2

Sample Output 3

No

The food with the greatest tastiness is Food 11, which he has no chance to eat.

update @ 2024/3/10 10:45:08