English · Original
Chinese · Translation
Formal · Original
You are given a text consisting of _n_ lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: '_a_', '_e_', '_i_', '_o_', '_u_' and '_y_'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "_mamma_" can be divided into syllables as "_ma_" and "_mma_", "_mam_" and "_ma_", and "_mamm_" and "_a_". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of _n_ integers _p_1, _p_2, ..., _p__n_. Text matches the given verse pattern if for each _i_ from 1 to _n_ one can divide words of the _i_\-th line in syllables in such a way that the total number of syllables is equal to _p__i_.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
## Input
The first line of the input contains a single integer _n_ (1 ≤ _n_ ≤ 100) — the number of lines in the text.
The second line contains integers _p_1, ..., _p__n_ (0 ≤ _p__i_ ≤ 100) — the verse pattern.
Next _n_ lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
## Output
If the given text matches the given verse pattern, then print "_YES_" (without quotes) in the only line of the output. Otherwise, print "_NO_" (without quotes).
[samples]
## Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "_ch_" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
你被给定一个由 #cf_span[n] 行组成的文本。每行包含若干由小写英文字母组成的、以空格分隔的单词。
我们定义一个音节为一个恰好包含一个元音字母、以及任意数量(可能为零)辅音字母的字符串。在英文字母中,以下字母被视为元音:'_a_', '_e_', '_i_', '_o_', '_u_' 和 '_y_'。
每个至少包含一个元音的单词都可以被划分为音节。每个字符必须恰好属于一个音节。例如,单词 "_mamma_" 可以被划分为音节 "_ma_" 和 "_mma_"、"_mam_" 和 "_ma_",或 "_mamm_" 和 "_a_"。仅由辅音组成的单词应被忽略。
给定文本的韵律模式是一个长度为 #cf_span[n] 的整数序列 #cf_span[p1, p2, ..., pn]。如果对于每个 #cf_span[i] 从 #cf_span[1] 到 #cf_span[n],都能将第 #cf_span[i] 行中的单词划分为音节,使得该行的音节总数等于 #cf_span[pi],则称该文本与给定韵律模式匹配。
你被给定文本和韵律模式。请判断该文本是否匹配给定的韵律模式。
输入的第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 100]) —— 文本的行数。
第二行包含整数 #cf_span[p1, ..., pn] (#cf_span[0 ≤ pi ≤ 100]) —— 韵律模式。
接下来的 #cf_span[n] 行包含文本本身。文本由小写英文字母和空格组成。保证所有行非空,每行以字母开头和结尾,单词之间恰好由一个空格分隔。每行长度不超过 #cf_span[100] 个字符。
如果给定文本匹配给定韵律模式,则在输出的唯一一行中打印 "_YES_"(不含引号);否则打印 "_NO_"(不含引号)。
在第一个样例中,可以将单词按如下方式划分为音节:
由于第三行中的单词 "_ch_" 不包含元音,我们可以忽略它。结果得到前两行各有 #cf_span[2] 个音节,第三行有 #cf_span[3] 个音节。
## Input
输入的第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 100]) —— 文本的行数。第二行包含整数 #cf_span[p1, ..., pn] (#cf_span[0 ≤ pi ≤ 100]) —— 韵律模式。接下来的 #cf_span[n] 行包含文本本身。文本由小写英文字母和空格组成。保证所有行非空,每行以字母开头和结尾,单词之间恰好由一个空格分隔。每行长度不超过 #cf_span[100] 个字符。
## Output
如果给定文本匹配给定韵律模式,则在输出的唯一一行中打印 "_YES_"(不含引号);否则打印 "_NO_"(不含引号)。
[samples]
## Note
在第一个样例中,可以将单词按如下方式划分为音节:in-tel co-de ch al-len-ge
由于第三行中的单词 "_ch_" 不包含元音,我们可以忽略它。结果得到前两行各有 #cf_span[2] 个音节,第三行有 #cf_span[3] 个音节。
**Definitions**
Let $ n \in \mathbb{Z} $ be the number of lines.
Let $ P = (p_1, p_2, \dots, p_n) \in \mathbb{Z}^n $ be the verse pattern.
Let $ T = (L_1, L_2, \dots, L_n) $ be the text, where each $ L_i $ is a string of space-separated words over the alphabet $ \Sigma = \{a, b, \dots, z\} $.
Let $ V = \{a, e, i, o, u, y\} $ be the set of vowels.
For a word $ w $, define $ s(w) $ as the number of vowels in $ w $.
A word is valid if $ s(w) \geq 1 $; otherwise, it is ignored.
**Constraints**
1. $ 1 \leq n \leq 100 $
2. $ 0 \leq p_i \leq 100 $ for all $ i \in \{1, \dots, n\} $
3. Each line $ L_i $ is non-empty, starts and ends with a letter, words are separated by exactly one space, and $ |L_i| \leq 100 $.
**Objective**
For each line $ i \in \{1, \dots, n\} $, let $ W_i $ be the list of words in $ L_i $.
Let $ S_i = \sum_{w \in W_i} s(w) $ be the total number of vowels (hence syllables) in line $ i $.
The text matches the verse pattern if and only if:
$$
\forall i \in \{1, \dots, n\}, \quad S_i = p_i
$$
Output "YES" if the condition holds; otherwise, output "NO".
API Response (JSON)
{
"problem": {
"name": "B. Verse Pattern",
"description": {
"content": "You are given a text consisting of _n_ lines. Each line contains some space-separated words, consisting of lowercase English letters. We define a syllable as a string that contains exactly one vowel ",
"description_type": "Markdown"
},
"platform": "Codeforces",
"limit": {
"time_limit": 1000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "CF722B"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given a text consisting of _n_ lines. Each line contains some space-separated words, consisting of lowercase English letters.\n\nWe define a syllable as a string that contains exactly one vowel ...",
"is_translate": false,
"language": "English"
},
{
"statement_type": "Markdown",
"content": "你被给定一个由 #cf_span[n] 行组成的文本。每行包含若干由小写英文字母组成的、以空格分隔的单词。\n\n我们定义一个音节为一个恰好包含一个元音字母、以及任意数量(可能为零)辅音字母的字符串。在英文字母中,以下字母被视为元音:'_a_', '_e_', '_i_', '_o_', '_u_' 和 '_y_'。\n\n每个至少包含一个元音的单词都可以被划分为音节。每个字符必须恰好属于一个音节。例如,...",
"is_translate": true,
"language": "Chinese"
},
{
"statement_type": "Markdown",
"content": "**Definitions** \nLet $ n \\in \\mathbb{Z} $ be the number of lines. \nLet $ P = (p_1, p_2, \\dots, p_n) \\in \\mathbb{Z}^n $ be the verse pattern. \nLet $ T = (L_1, L_2, \\dots, L_n) $ be the text, where e...",
"is_translate": false,
"language": "Formal"
}
]
}