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

Разделы > Linear Data Structures: Arrays > задача:


50986 - The Oldest Person

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

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

• 50468 - Draw Matrix - 2
• 51099 - Mr. Monk
• 51012 - Palindrome-k
• 51096 - Guess the number - 2
• 50448 - Paint Buckets
• 50925 - Optimizing Elevator Usage
• 50269 - Matrix Determinant
• 50988 - Laplacian Filter
• 50986 - The Oldest Person
• 51173 Question 5
• 50873 - Max Frequency
• 51009 - Sum of the nth row
• 51107 - Factorial
• ECE - Question 1
• CEN - Question 1
• Reflektimi i pikes
• 50972 - Division

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
CEN112 2016 Questions 15-PE2-7.

The Oldest Person

Question: For the history lesson, your sister has to find some people and then, she has to identify also the oldest person. Write a program that reads birth and death dates of n people, and then, it calculates the oldest m people. If two people have lived the same number of years, then check and compare according to the months and days. If they have also the same number of days and months, list the person whose id is smaller. Note: Assume that there is no date before 1-1-1900

Input specification: You will be given two integers in the beginning: the number of people (n) and the number of people to show where 0 ≤ m ≤ n ≤ 10,000. In the following n lines, you will be given two dates information (day-month-year): birth and death dates of people. Assume that there are 30 days in every month. And, there are 360 days in every year.

Output specification:
Show IDs of m oldest people where IDs are from 1 to n (order of appearance).

Sample Input I
4 2
5-12-2004 5-12-2006
5-12-1976 5-12-1986
5-12-1945 5-12-1985
5-12-1974 5-4-1975
Sample Output I
3 2



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

www.contester.ru