AtCoder Beginner Contest 463
B
列车订座
Train Reservation
AtCoder
⌀ 0
原题
← AD →

列车订座AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

Takahashi is trying to reserve a seat on a train.

高桥正在尝试预订列车座位。AI (CI翻译)

There are $N$ trains he is considering as candidates for reservation, numbered $1, 2, \dots, N$. Each train has seats in five columns, called column A, column B, column C, column D, and column E.

他考虑预订 $N$ 列列车,编号为 $1, 2, \dots, N$。每列列车的座位分为五列,分别称为 A 列、B 列、C 列、D 列和 E 列。AI (CI翻译)

The current seat availability information for each train is given as strings $S_1, S_2, \dots, S_N$. Here, $S_1, S_2, \dots, S_N$ all have length $5$, and columns A through E of train $i$ correspond to the first through fifth characters of $S_i$, respectively. If that character is o, there is a vacant seat in the corresponding column; if it is x, there is no vacant seat in the corresponding column.

每列列车当前的座位空余情况由字符串 $S_1, S_2, \dots, S_N$ 给出。其中,每个字符串的长度均为 $5$,列车 $i$ 的 A 列到 E 列分别对应 $S_i$ 的第一个到第五个字符。如果对应字符为 o,表示该列有空位;如果为 x,表示该列没有空位。AI (CI翻译)

Takahashi wants to reserve a seat in column $X$, where $X$ is one of A, B, C, D, E. Determine whether there is a vacant seat in column $X$ on at least one train.

高桥想预订 X 列的座位,其中 X 是 A、B、C、D、E 之一。请判断是否至少有一列列车的 X 列存在空位。AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $N$ is an integer between $1$ and $100$, inclusive.
  • $X$ is one of A, B, C, D, E.
  • $S_i$ is a string of length $5$ consisting of o and x.
  • $N$ 是一个介于 $1$ 和 $100$ 之间(含端点)的整数。
  • $X$ 是 A、B、C、D、E 之一。
  • $S_i$ 是一个由 o 和 x 组成、长度为 $5$ 的字符串。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format:

输入从标准输入按以下格式给出:AI (CI翻译)

N X
S_1
S_2
\vdots
S_N

N X
S_1
S_2
\vdots
S_N
AI (CI翻译)

Output

输出格式

AI (CI翻译)

If there is a vacant seat in column $X$ on at least one train, output Yes; otherwise, output No.

如果至少有一列列车的 X 列存在空位,输出 Yes;否则,输出 No。AI (CI翻译)

样例

Input #1
3 A
xoxox
xxooo
oxxxx
Output #1
Yes
Train $3$ has a vacant seat in column A. Thus, output `Yes`.
Input #2
5 C
xoxoo
oxxoo
oxxxo
xoxxx
oxxoo
Output #2
No
No train has a vacant seat in column C. Thus, output `No`.
题目信息
题号
abc463_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。