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

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


50747 - Safe boxes against thieves

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

• 50757 - National Elections - 1
• 50755- Top N Donors - 1
• 50752 - Student Groups
• 50753 - Average of the Nth Student
• 50751 - The biggest Minute
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon
• 50835 - Club Presidency
• 50747 - Safe boxes against thie...
• 50742 - King Arthur II
• 50352 - Selling Cows
• 50872 - Top M Grades
• 50868 - Sort Frequencies
• 50912 - Trip to Librazhd
• Trip to Librazhd
• 50361 - Align Two Lists
• 50914 - Buy 3, Pay 2

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
CEN112 Homeworks 15-SprPrE1-60.

Safe boxes against thieves

You work in a gold store. They have several safe boxes. They put the jewelry into these boxes every day. And to protect from the thieves, time to time they change the the items in safe boxes. And so, in a file they store the values of items in each box.

Question: Write a program that is going to read the information for the safe boxes and defines the box which has the most valuable m items.

Input specification
In the beginning, you will be given two integers: number of numbers (n) and top m items to calculate where 1 ≤ (n and m) ≤ 100. Then, in the following n lines you will be given at most 1,000 integers ending with a negative number where each number is between 1 and 1,000,000.

Output specification
Show one number: ID (order) of the first box which has the most valuable m items.

Sample Input I
3 2
7 15 10 10 10 12 12 -2
7 4 10 5 -3
19 15 3 19 -1
Sample Output I
3

Explanation: Total amount of most valuable 2 items:

  • in safe box 1: 27
  • in safe box 2: 17
  • in safe box 3: 38


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

www.contester.ru