102521: [AtCoder]ABC252 B - Takahashi's Failure

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

Takahashi has $N$ foods in his house. The $i$-th food has the tastiness of $A_i$.
He dislikes $K$ of these foods: for each $i=1,2,\ldots,K$, he dislikes the $B_i$-th food.

Out of the foods with the greatest tastiness among the $N$ 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

  • $1\leq K\leq N\leq 100$
  • $1\leq A_i\leq 100$
  • $1\leq B_i\leq N$
  • All $B_i$ are distinct.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$ $K$
$A_1$ $A_2$ $\ldots$ $A_N$
$B_1$ $B_2$ $\ldots$ $B_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 $3$ and $5$, of which he eats one.
He dislikes Food $2$, $3$, and $4$, one of which he has a chance to eat: Food $3$.
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 $1$, $2$, and $3$, 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 $1$, which he has no chance to eat.

Input

题意翻译

给定 $n$ 及 $a_1,a_2,\ldots,a_n$ ; $a_i(1 \le i \le n)$ 表示第 $i$ 种食物的美味程度. 再给定 $k$ 及 $b_1,b_2,\ldots,b_n$ ; $b_i(1 \le i \le k)$ 表示高桥君不喜欢吃第 $i$ 种食物。 现在,请你判断美味程度最大的食物中有没有高桥君不喜欢吃的食物,如果有,输出 ```Yes``` ,否则输出 ```No``` .

Output

得分:$200$分

问题描述

高桥家里有$N$种食物。第$i$种食物的美味程度为$A_i$。

他不喜欢其中的$K$种食物:对于每$i=1,2,\ldots,K$,他不喜欢第$B_i$种食物。

在$N$种食物中,美味程度最高的食物中,高桥将随机选择一种并吃掉它。

如果他有机会吃到不喜欢的食物,输出Yes;否则,输出No

限制条件

  • $1\leq K\leq N\leq 100$
  • $1\leq A_i\leq 100$
  • $1\leq B_i\leq N$
  • 所有的$B_i$都是不同的。
  • 输入中的所有值都是整数。

输入

从标准输入以以下格式获取输入:

$N$ $K$
$A_1$ $A_2$ $\ldots$ $A_N$
$B_1$ $B_2$ $\ldots$ $B_K$

输出

如果高桥有机会吃到不喜欢的食物,输出Yes;否则,输出No


样例输入 1

5 3
6 8 10 7 10
2 3 4

样例输出 1

Yes

在五种食物中,美味程度最高的食物是食物$3$和$5$,他会从中吃一种。

他不喜欢食物$2$、$3$和$4$,其中有一种他有机会吃到:食物$3$。

因此,答案是Yes


样例输入 2

5 2
100 100 100 1 1
5 4

样例输出 2

No

美味程度最高的食物是食物$1$、$2$和$3$,他没有机会吃到其中的任何一种。


样例输入 3

2 1
100 1
2

样例输出 3

No

美味程度最高的食物是食物$1$,他没有机会吃到。

加入题单

算法标签: