HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN254 Practice Exam 2 > problem:


2. 51132 - Problem Solving Competition

CEN254 Practice Exam 2

Start: May.30.2017 at 12:50:00 PM
Finish: May.30.2017 at 01:36:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 1. 51131 - Running After a Thief
• 2. 51132 - Problem Solving Co...

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.

Problem Solving Competition

Problem solving competition goes on at the South-West Primary school. However, there are slight changes in competition rules. You are first given number questions solved by students on different days. Then, you are given list of students who are in the same class. Because there are some classes with a few students, for finding top solving class, administration wants to use only the classes which have at least k students.

Question: Write a program that reads information and finds the class which has solved the most number of questions in average.

Input specification: First, you will be given two integers: number of students (n), and minimum number of students in a class to process. The following n lines will provide a student name and the number of questions solved by this student on a specific day. Next line has an integer (m) number of student class relations. The following m lines lists the names of two students (st1 st2) where st1 and st2 are in the same class and 1 ≤ k ≤ (n and m) ≤ 50,000.

Output specification: Show the average (with two digits precision) of class which has at least k students and has the highest average.

Sample Input 1 Sample Input 2
8 2
Albi 8
Ardi 4
Erdi 5
Andi 5
Erdi 4
Erdi 6
Albi 12
Alvi 2
3
Albi Alvi
Andi Erdi
Erdi Ardi
10 2
Olgers 9
Erjon 3
Erjon 10
Klaudja 2
Olgers 9
Erjon 7
Flonja 10
Gjoni 4
Mabel 22
Klaudja 2
3
Olgers Erjon
Gjoni Klaudja
Flonja Klaudja
Sample Output 1 Sample Output 2
11.00 19.00

Explanation for Sample Input 2: There are 3 different classes. Mabel is alone and he has solved the most number of questions. But because the number of students in his class is less than minimum number of students (2), his average is not count for the competition. As a result, the class with Erjon and Olgers has solved the most number of questions with an average of 19.



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

www.contester.ru