HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Questions 2016 > problem:


15-FE-1. 50992 - Top K Obese Classes

CEN112 Questions 2016

Start: Mar.30.2016 at 03:10:22 PM
Finish: Apr.01.2016 at 05:00:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 15-FE-1. 50992 - Top K Obese C...
• 15-FE-2. 50993 - Products in store
• 15-FE-3. 50994 - The Most Crowded...
• 15-FE-4. 50995 - Group Average
• 15-FE-6. 50989 - Rectangles and Points
• 15-FE-7. 50990 - Two Neighbors
• 15-FE-8. 50991 - Intersecting Circles
• 15-HW-2. 50932 - Shifting rows and...
• 15-HW-3. 50933 - Sum of the Bigges...

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.

Top K Obese Classes

Question: School doctor wants to start a campaign against obesity. She wants to work on top k fat classes. And, she has announced that she is going to calculate class Body Mass Indexes (BMI) and the most fit class will be awarded where

BMI = weightInKilograms / (heightInMeters * heightInMeters)
Write a program that is going to read student weight and height information from n classes and the program will define the top k classes (whose BMI is the biggest).

Input specification: First, you will be given two integers: the number of classes (n) and the number of top (k) classes to list. The following n lines will start with an integer (m) and will be followed by m pairs of numbers: an integer (weightInKilograms) and a floating point number (heightInMeters). Each pair will be followed by a semicolon where 1 ≤ n ≤ 1,000 and 1 ≤ m ≤ 60.

Output specification: Show k integers (orders of top k classes). If there are two classes with the same BMI average (if the BMI difference between two classes is smaller than 0.0001), first show the one with the smaller class ID (order of class).

Sample Input
6 3
3 54 1.74; 45 1.46; 36 1.33;
4 35 1.86; 51 1.65; 65 1.74; 57 1.99;
3 67 1.79; 44 1.32; 47 1.40;
3 58 1.33; 54 1.40; 42 1.49;
4 70 1.34; 56 1.30; 49 1.33; 48 1.32;
2 65 1.35; 38 1.88;
Sample Output
5 4 3

Explanation: There are 6 classes given, and the top 3 classes will be listed. BMI of the 3 people in the first class are: 17.84, 21.11, and 20.35. And thus the class BMI average is 19.766. The table below, lists the class BMI averages:

Class ID Class BMI
1 19.766
2 16.178
3 23.381
4 26.419
5 31.842
6 23.208



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

www.contester.ru