CF722B.Verse Pattern
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
给定一个由 n 行组成的文本。每行包含若干由空格分隔的单词,每个单词均由小写英文字母组成。
我们定义一个**音节(syllable)**为一个恰好包含一个元音字母、以及任意数量(可能为零)辅音字母的字符串。在英文字母表中,以下字母被视为元音:'a'、'e'、'i'、'o'、'u' 和 'y'。
文本中每个至少含有一个元音的单词均可被划分为若干音节,且每个字符必须且仅属于一个音节。例如,单词 "mamma" 可划分为音节 "ma" 和 "mma",或 "mam" 和 "ma",或 "mamm" 和 "a"。仅由辅音组成的单词应被忽略。
给定文本的诗律模式(verse pattern)是一个长度为 n 的整数序列 p1,p2,…,pn。若对每个 i(1≤i≤n),第 i 行的单词均能被划分为若干音节,使得该行所有音节的总数恰好等于 pi,则称该文本匹配给定的诗律模式。
现给你一段文本及其对应的诗律模式,请判断该文本是否匹配该诗律模式。
输入格式
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.
输入的第一行包含一个整数 n(1 ≤ n ≤ 100)—— 表示文本的行数。
第二行包含 n 个整数 p1, ..., pn(0 ≤ pi ≤ 100)—— 表示诗律模式。
接下来的 n 行为文本本身。文本仅由小写英文字母和空格组成。保证所有行均非空,且每行均以字母开头并以字母结尾,单词之间恰好由一个空格分隔。每行长度不超过 100 个字符。
输出格式
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).
如果给定文本符合给定的诗律模式,则在输出的唯一一行中打印 “YES”(不带引号)。否则,打印 “NO”(不带引号)。
输入输出样例
输入#1
3 2 2 3 intel code ch allenge
输出#1
YES
输入#2
4 1 2 3 1 a bcdefghi jklmnopqrstu vwxyz
输出#2
NO
输入#3
4 13 11 15 15 to be or not to be that is the question whether tis nobler in the mind to suffer the slings and arrows of outrageous fortune or to take arms against a sea of troubles
输出#3
YES
说明/提示
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.
在第一个样例中,可以将单词按如下方式划分为音节:
in-tel
co-de
ch al-len-ge
由于第三行中的单词 “ch” 不包含元音字母,因此可以忽略它。最终得到前两行各有 2 个音节,第三行有 3 个音节。
输入解题思路,AI测评打分。不知道怎么写?