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 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0 0 0 0 1 1 1 1 1 1 0 1 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.