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

Турниры > CEN112 Homeworks 2013-2015 > задача:


15-SprPrE1-40. 50748 - Gold Store

CEN112 Homeworks 2013-2015

Старт: 15.дек.2013 в 12:00:00
Финиш: 15.дек.2013 в 17:00:00
Турнир завершён!
• Турнирная таблица

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

Задачи турнира

• 15-SprHW-20. 50446 - Snake
• 15-SprHW-30. 50788 - Eight Puzzle
• 15-SprHW-40. 50746 - Most Visited
• 15-SprHW-60. 50516 - Lines
• 15-SprPr2-20. 50509 - Reading Book
• 15-SprPr2-60. 50766 - Word Puzzle
• 15-SprPr2-80. 50786 - Top Question
• 15-SprPrE1-20. 50785 - Swimming ...
• 15-SprPrE1-40. 50748 - Gold Store
• 15-SprPrE1-70. 50507 - Sequential ...
• 15-SprResit-20. 50447 - Swimming ...

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

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

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

Gold Store

You work in a Gold Store. Every item in the store has different weight and price. And, you have two safe deposit boxes. The first safe box is stronger than the other one and it can properly hold at most m items.

Because everyday several items are sold and several other new items arrive to the store, you want to write a program which decides what items to choose for the first safe box. Items are put in descending order according to their price per unit weight. If two items have the same unit price, then the item with the smaller id is before the other one.

Question: Write a program that is going to read n item information, then it will show top m items to store in the first safe box.

Input specification
You will be given two integers (n and m) the number of items and top m items to show where 0 ≤ n, m ≤ 3000. Then, in the following n lines you will be given three information for each item:

  • ID: an integer between 1 and 1e6
  • Weight: an integer between 1 and 1e5
  • Price: an integer between 0 and 1e8

Output specification
Show the ID and unit price of top m items.

Sample Input I
3 3
1 20 100
2 10 60
3 30 120
Sample Output I
2 6
1 5
3 4



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

www.contester.ru