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

Разделы > Сортировка и последовательности > задача:


50736 - Top N Donors - 2

Гость
• Обсуждение задачи (1)

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

• 50731 - The largest product (2)
• 50732 - Sorting
• 50549 - k-Nearest Neighbours (kNN)
• 50290 - Minimax Sum
• 50738 - Median value
• 50317 - Student Line Up
• 50311 - Student Line Up
• 50320 - Random Sorted List
• 50736 - Top N Donors - 2
• 50733 - The Highest Average
• 50364 - Student averages
• 50333 - Series of Squares
• 50734 - Product Info (In Srt)
• 50735 - Top M Products
• 50339 - The Largest Rectangle
• 50492 - Contest Scoreboard
• 50737 - Sum of the k-largest numbers

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

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

Лимит времени 40000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Ibrahim Mesecan. Сложность Бета

Top N Donors - 2

Shpresa Fondation collects money from its donors. And then it distributes the collected money to the people who need. The money is collected directly from people or people donates through different banks. This year, they want to present certificates to their Top N Donors and thus they need to put the donors in descending order according to their total donation.

Question:
Write a program that is going to read m donors' name surname and the amount donated, and then the program is going to list top n donors in descending order.
Note: Pay attention for the worst case running time.

Input specification
You will be first given 2 integer numbers: The number of donors (m) and the number of (n) top donors to be listed where 1 ≤ m ≤ 60,000 and 1 ≤ n ≤ 1000. Then the following m lines will give m donors names and surnames and amount of donation. Every name and surname contains at most 12 characters. And amountDonated can be floating point number between 0 and 106

Output specification
Show name surname and amountDonated of top n people in descending order.

Sample Input I
  6 4
  Erma Gomez 85
  Christopher Hampton 352  
  Geraldine Craig 335
  Barbara Bennett 8
  Carmen Horton 375.5
  Margie Reid 405
Sample Input II
  10 5
  Archie Cortez 366.8
  Carla Caldwell 1664.5
  Don Townsend 4435
  Drew Stewart 3520
  Emanuel Hines 3262
  Lloyd Parks 5965
  Marcia Phillips 2327
  Oliver Burgess 748
  Robin Collins 774
  Rosemary Rice 4240.7
Sample Output I
  Margie Reid 405
  Carmen Horton 375.5
  Christopher Hampton 352
  Geraldine Craig 335
Sample Output II
  Lloyd Parks 5965
  Don Townsend 4435
  Rosemary Rice 4240.7
  Drew Stewart 3520
  Emanuel Hines 3262


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

www.contester.ru