Universal Cup Judging System

Universal Cup

Time Limit: 2 s Memory Limit: 2048 MB Total points: 100 Difficulty: [show] Hackable ✓
Statistics

小青鱼非常喜欢不同的语言。今天,他想向你介绍粤语。

粤语的音节可以使用粤拼(Jyutping)$^\ast$以拉丁字母书写。他给你一个字符串 $s$,并询问它是否是一个不带声调数字的合法粤语音节的拼写。

在本题中,完整的规则由下表给出。每一列是一个声母(initial),即音节开头的部分;每一行是一个韵母(final),即其余的部分。标有 $\varnothing$ 的列表示零声母(空声母),即不包含任何字母。包含 $1$ 的单元格表示该声母和韵母可以组合;包含 $0$ 的单元格表示不能组合。合法的拼写是通过将单元格为 $1$ 的那一列的声母与那一行的韵母按此顺序拼接得到的。其他任何拼写均不合法。

韵母包括其元音(韵腹)和任何结尾辅音(韵尾)。韵母 m 和 ng 是特殊的鼻音,可以不含元音独立构成音节;它们允许的组合也包含在表中。书写时只写出表中所示的字母:没有空格、分隔符或声调数字。

例如,ngaan 和 zeoi 是合法的拼写,而 chong 不是。请帮助小青鱼检查他的拼写。

韵母 $\varnothing$ b p m f d t n l g k ng h gw kw w z c s j
aa 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
aai 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
aau 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1
aam 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0
aan 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0
aang 1 1 1 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1
aap 1 0 0 0 0 1 1 1 1 1 0 1 1 0 0 0 1 1 1 1
aat 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 0
aak 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
a 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0
ai 1 1 1 1 1 1 1 1 1 1 1 1 1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 0 0 0 1 1 1 1
yut 0 0 0 0 0 1 1 0 1 1 1 0 1 0 0 0 1 1 1 1
m 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0
ng 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0

$^\ast$为了简单起见,在本题中,小青鱼已经从他的笔记中去掉了声调数字。

上表改编自香港语言学学会(Linguistic Society of Hong Kong)的《电脑用汉字粤语拼音表》(CC BY 4.0),并包含了粤拼方案及其2018 年新增韵母建议中所述的新增内容。上方表格中的单元格定义了本题所接受的拼写。

输入格式

第一行包含一个整数 $T$($1 \le T \le 10^5$),表示测试数据的组数。

每组测试数据仅有一行,包含一个字符串 $s$($1 \le |s| \le 6$),仅由小写英文字母(a 到 z)组成。

输出格式

对于每组测试数据,如果 $s$ 是合法的拼写,则输出 Yes,否则输出 No。

样例

输入格式 1

5
ngaan
zeoi
chong
jaai
pak

输出格式 1

Yes
Yes
No
Yes
No

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.