codeforces-scrape

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

1166B.md (1632B)


      1 Source: https://codeforces.com/problemset/problem/1166/B
      2 
      3 B. All the Vowels Please
      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 Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length $k$ is vowelly if there are positive integers $n$ and $m$ such that $n\cdot m = k$ and when the word is written by using $n$ rows and $m$ columns (the first row is filled first, then the second and so on, with each row filled from left to right), every vowel of the English alphabet appears at least once in every row and every column.
     22 
     23 You are given an integer $k$ and you must either print a vowelly word of length $k$ or print $-1$ if no such word exists.
     24 
     25 In this problem the vowels of the English alphabet are 'a', 'e', 'i', 'o' ,'u'.
     26 
     27 Input
     28 
     29 Input consists of a single line containing the integer $k$ ($1\leq k \leq 10^4$) — the required length.
     30 
     31 Output
     32 
     33 The output must consist of a single line, consisting of a vowelly word of length $k$ consisting of lowercase English letters if it exists or $-1$ if it does not.
     34 
     35 If there are multiple possible words, you may output any of them.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 7
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 -1
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 36
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 agoeuioaeiruuimaeoieauoweouoiaouimae
     61 ```
     62 
     63 Note
     64 
     65 In the second example, the word "agoeuioaeiruuimaeoieauoweouoiaouimae" can be arranged into the following $6 \times 6$ grid:
     66 
     67  ![](https://espresso.codeforces.com/ca9a1f0df285264864367c35f3fdba63f78124da.png) 
     68 
     69 It is easy to verify that every row and every column contain all the vowels.