HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN_114 Midterm B > problem:


15. 50734 - Product Info (In Srt)

CEN_114 Midterm B

Start: May.14.2020 at 12:00:01 AM
Finish: May.31.2020 at 11:59:59 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 10. 51095 - Normal and Trace
• 11. 51089 - Multiply a row and add i...
• 12. 50749 - Min Distance
• 13. 51124 - Easy Tiae words
• 14. 51136 - Class Average 2
• 15. 50734 - Product Info (In Srt)
• 2. 50453 - The Cubic Difference
• 3. 50346 - The Biggest Date
• 5. 50380 - Sum of the Numbers in t...
• 6. 50443 - Dajte Express
• 7. 50496 - Falling Bricks
• 8. 51123 - Mr. Li Criteria
• 9. 50529 - Row to Table

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.
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