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

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


50734 - Product Info (In Srt)

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

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

• 50737 - Sum of the k-largest numbers
• 50492 - Contest Scoreboard
• 50320 - Random Sorted List
• 50738 - Median value
• 50317 - Student Line Up
• 50311 - Student Line Up
• 50736 - Top N Donors - 2
• 50333 - Series of Squares
• 50734 - Product Info (In Srt)
• 50364 - Student averages
• 50733 - The Highest Average
• 50358 - Series of Odd Numbers
• 50756 - Average of the Nth Student
• 50347 - Selling Oranges
• 50758 - National Elections - Revisited
• 50757 - National Elections - 1
• 50755- Top N Donors - 1

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Ibrahim Mesecan.

Product Info

Mr. Enea, sells building and sanitary materials. After selling the products he processes through his stock book. But, he wants to renew his system and to pass to a computerized system.

Question: Write a program that is going to read the stock information. And, show the most sold top m items.
Note: Use Quick sort to solve the problem.

Input specification
First, you will be given two numbers n and m, where

  • 1 < n ≤ 5000, that shows the number of items in the store
  • 1 < m ≤ 50, that shows the number of top m items to show as the output.
Then, in the following n lines you will be given space separated product information. Every line contains the following information:
  1. Product ID: Every product is given a product ID on its entry. an integer number smaller than 10 million
  2. Product name: At most 20 chars (single word but may contain an under_score sign) string
  3. Product category: At most 20 chars (single word but may contain an under_score sign) string
  4. Entry price: a floating point number
  5. Sell price: a floating point number
  6. Amount sold: The number of items sold on different days. Space separated series of 5 integers
where Product name and Product category fields may contain only English letters and under_score sign.

Output specification
Show

  • the Product ID
  • the Product name and
  • the total amount sold
of the top m items in decreasing order of amount sold.

Sample Input
  5 3
  1 Radiators Supplies 40.00 46.40 12 18 24 7 15
  2 Galvanized Fittings 17.63 21.15 6 1 16 17 1
  3 Flexible Connectors 11.50 13.11 16 12 16 4 22
  4 Larger_Diana Vessels 21.25 25.93 18 25 8 8 19
  5 Carusso Vessels 18.00 24.84 14 18 3 2 25

Sample Output
  4 Larger_Diana 78
  1 Radiators 76
  3 Flexible 70

Output Explanation :
  Product 4 is the most sold product: 78 pieces of it has been sold. That is followed by the products 1 and 3 which have been sold 76 and 70 pieces.


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

www.contester.ru