ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Linear Data Structures: Arrays > задача:


51132 - Problem Solving Competition

Гость
• Вопросы к жюри (2)

Задачи раздела

• 51124 - Easy Tiae words
• 51145 - Graduation Exam
• 51117 - The Most Crowded
• 51146 - Popular Baby Names
• 51131 - Running After a Thief
• 51143 - Departments Competition
• 50994 - The Most Crowded Station
• 51118 - Place 7 to the 5th position
• 51132 - Problem Solving Comp...
• 51121 - Complexity power of a nu...
• 51119 - Evaluating Prefix expressions
• 50563 - Modul i gjate
• 50594 - Transformimet
• 51182 - Count and Sum 2
• 51193 - The max element of k-th co...
• 51194 - The difference between max...
• 51196 - The sum of two arrays

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
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