codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

722B.md (2641B)


      1 Source: https://codeforces.com/problemset/problem/722/B
      2 
      3 B. Verse Pattern
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 You are given a text consisting of *n* lines. Each line contains some space-separated words, consisting of lowercase English letters.
     22 
     23 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'.
     24 
     25 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.
     26 
     27 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*.
     28 
     29 You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
     30 
     31 Input
     32 
     33 The first line of the input contains a single integer *n* (1 ≤ *n* ≤ 100) — the number of lines in the text.
     34 
     35 The second line contains integers *p*1, ..., *p**n* (0 ≤ *p**i* ≤ 100) — the verse pattern.
     36 
     37 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.
     38 
     39 Output
     40 
     41 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).
     42 
     43 Examples
     44 
     45 Input
     46 
     47 ```
     48 3  
     49 2 2 3  
     50 intel  
     51 code  
     52 ch allenge
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 YES
     59 ```
     60 
     61 Input
     62 
     63 ```
     64 4  
     65 1 2 3 1  
     66 a  
     67 bcdefghi  
     68 jklmnopqrstu  
     69 vwxyz
     70 ```
     71 
     72 Output
     73 
     74 ```
     75 NO
     76 ```
     77 
     78 Input
     79 
     80 ```
     81 4  
     82 13 11 15 15  
     83 to be or not to be that is the question  
     84 whether tis nobler in the mind to suffer  
     85 the slings and arrows of outrageous fortune  
     86 or to take arms against a sea of troubles
     87 ```
     88 
     89 Output
     90 
     91 ```
     92 YES
     93 ```
     94 
     95 Note
     96 
     97 In the first sample, one can split words into syllables in the following way:
     98 
     99 ```
    100 in-tel  
    101 co-de  
    102 ch al-len-ge
    103 ```
    104 
    105 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.