Route Map

AtCoder
IDabc236_c
Time2000ms
Memory256MB
Difficulty
There are $N$ stations on a certain line operated by AtCoder Railway. The $i$\-th station $(1 \leq i \leq N)$ from the starting station is named $S_i$. Local trains stop at all stations, while express trains may not. Specifically, express trains stop at only $M \, (M \leq N)$ stations, and the $j$\-th stop $(1 \leq j \leq M)$ is the station named $T_j$. Here, it is guaranteed that $T_1 = S_1$ and $T_M = S_N$, that is, express trains stop at both starting and terminal stations. For each of the $N$ stations, determine whether express trains stop at that station. ## Input Input is given from Standard Input in the following format: $N$ $M$ $S_1$ $\ldots$ $S_N$ $T_1$ $\ldots$ $T_M$ ## Constrains * $2 \leq M \leq N \leq 10^5$ * $N$ and $M$ are integers. * $S_i$ $(1 \leq i \leq N)$ is a string of length between $1$ and $10$ (inclusive) consisting of lowercase English letters. * $S_i \neq S_j \, (i \neq j)$ * $T_1 = S_1$ and $T_M = S_N$. * $(T_1, \dots, T_M)$ is obtained by removing zero or more strings from $(S_1, \dots, S_N)$ and lining up the remaining strings without changing the order. [samples]
Samples
Input #1
5 3
tokyo kanda akiba okachi ueno
tokyo akiba ueno
Output #1
Yes
No
Yes
No
Yes
Input #2
7 7
a t c o d e r
a t c o d e r
Output #2
Yes
Yes
Yes
Yes
Yes
Yes
Yes

Express trains may stop at all stations.
API Response (JSON)
{
  "problem": {
    "name": "Route Map",
    "description": {
      "content": "There are $N$ stations on a certain line operated by AtCoder Railway. The $i$\\-th station $(1 \\leq i \\leq N)$ from the starting station is named $S_i$. Local trains stop at all stations, while express",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc236_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "There are $N$ stations on a certain line operated by AtCoder Railway. The $i$\\-th station $(1 \\leq i \\leq N)$ from the starting station is named $S_i$.\nLocal trains stop at all stations, while express...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments