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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1 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0
uk 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1
yu 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
yun 0 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.