HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC 2017 > problem:


2. 51126 - Dr. Fllanxha

IMPC 2017

Start: May.27.2017 at 09:25:00 AM
Finish: May.27.2017 at 01:00:00 PM
The contest is finished!
• Contest scoreboard

Contest problems

• 1. 51125 - Filling an Array 3
• 2. 51126 - Dr. Fllanxha
• 3. 51127 - Maze solver
• 5. 51129 - Hexagon
• 6. 51130 - Permutation of Everything

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Dr. Fllanxha

Dr. Fllanxha opposes Dr. Li for the complexity of Tiae words. Dr. Fllanxha says:

"According to the formula that Dr. Li used: 'Ra', 'Sara', 'Desara' and 'Katerina' have all the same difficulty. However, Katerina should have a larger difficulty value compared to Sara or others due to the number of letters used.".

He defines the difficulty of a word using the vowels (a, e, i, o, and u).

For example: the word "Ra" has 1 vowel and 2 letters and its TV is 4; the word "Sara" has 2 vowels and 4 letters with a TV of (4*4/2=) 8. The words whose TV is closer to 0 are easier.

Question: Write a program that reads a name and surnames of (n) people. Then, the program prints the top (m) easy names. If there are two names whose difficulty is similar (TV difference is less than 0.0001) show in alphabetical order according to name and surname (name + surname).
Note: 1) ASCII table values are used when ordering: A is before B and Uppercase letters are smaller than lowercase letters. 2) Assume that spaces in the name are not count for calculating difficulty (only the letters count). 3) But the space is count when ordering: for example, 'Ana Maria' is before 'AnaMaria'. 4) All names (name+surname) have at least one vowel in them.
If needed you can use bool isVowel(char ch);
function from #include "utils/functions.h" library.

Input specification: You will be given two integers: the number of names (n), and the number of top (m) names to show. The following n lines contain a name and surname of n people separated by semicolon and space where names contain only 26 English uppercase or lowercase letters; and 0 ≤ m ≤ n ≤ 50,000.

Output specification: Show top m easy names.

Sample Input 1 Sample Input 2
6 3
Li; Peka
Bedjna Artemisa; Veliaj
Shi; Hysi
Li; Nemi
Fllanxha; Kasemi
Erban; Hasani
6 3
Elvi Terrence; Reka
Irvin; Canaj
Mo; Ortiz
Denise; Blloku
Gjorgja Long; Pjetri
Inr; Jensen
Sample Output 1 Sample Output 2
Li Nemi
Li Peka
Erban Hasani
Mo Ortiz
Irvin Canaj
Inr Jensen

Explanation: The list of Tiae names sorted according to difficulty for the sample input 1:
  Li Nemi 12
  Li Peka 12
  Erban Hasani 24.2
  Shi Hysi 24.5
  Fllanxha Kasemi 39.2
  Bedjna Artemisa Veliaj 44.444
Li Nemi and Li Peka have the same difficulty and thus they are sorted according to alphabetical order.



Для отправки решений необходимо выполнить вход.

www.contester.ru