题目描述
Problem Description
On a certain route of AtCoder Railway, there are $ N $ stations, and the name of the $i\ \,\ (1\ \leq\ i\ \leq\ N)$ th station from the starting point to the terminal is $ S_i $.
Local trains stop at all stations, but express trains do not necessarily stop at all stations. Specifically, express trains only stop at $M\ \,\ (M\ \leq\ N)$ stations, and the name of the $j\ \,\ (1\ \leq\ j\ \leq\ M)$ th station where an express train stops is $ T_j $. However, it is guaranteed that $T_1\ =\ S_1$ and $T_M\ =\ S_N$, meaning express trains stop at both the starting point and the terminal.
For each of the $ N $ stations, determine whether an express train stops at that station.
Input Format
The input is given from the standard input in the following format:
$ N $ $ M $ $ S_1 $ $\ldots$ $ S_N $ $ T_1 $ $\ldots$ $ T_M $
Output Format
Output $ N $ lines. The $i\ \,\ (1\ \leq\ i\ \leq\ N)$ th line should contain Yes if an express train stops at the $ i $ th station from the starting point to the terminal, and No otherwise.
Sample Input and Output
Sample Input #1
5 3
tokyo kanda akiba okachi ueno
tokyo akiba ueno
Sample Output #1
Yes
No
Yes
No
Yes
Sample Input #2
7 7
a t c o d e r
a t c o d e r
Sample Output #2
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Notes/Hints
Constraints
- $2\ \leq\ M\ \leq\ N\ \leq\ 10^5$
- $N,\ M$ are integers
- $S_i\ \,\ (1\ \leq\ i\ \leq\ N)$ is a string consisting of lowercase English letters, with a length between $ 1 $ and $ 10 $ characters
- $S_i\ \neq\ S_j\ \,\ (i\ \neq\ j)$
- $T_1\ =\ S_1$ and $T_M\ =\ S_N$
- $(T_1,\ \dots,\ T_M)$ can be obtained by removing $ 0 $ or more strings from $(S_1,\ \dots,\ S_N)$ and arranging the remaining strings in their original order
Sample Explanation 2
Express trains may stop at all stations.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分