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

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


50868 - Sort Frequencies

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

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

• 50751 - The biggest Minute
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon
• 50835 - Club Presidency
• 50747 - Safe boxes against thieves
• 50742 - King Arthur II
• 50352 - Selling Cows
• 50872 - Top M Grades
• 50868 - Sort Frequencies
• Trip to Librazhd
• 50912 - Trip to Librazhd
• 50914 - Buy 3, Pay 2
• 50732 - Sorting
• 50730 - The largest product
• 50731 - The largest product (2)
• 50737 - Sum of the k-largest numbers
• 50492 - Contest Scoreboard

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

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

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

Sort Frequencies

Question: Your sister has a math homework. She has to find the frequencies of some sequences complying the given function. The professor gives n squences of numbers and two numbers. She has to count the number of numbers which are smaller than or equal to the first number and greater than or equal to the second number.

Question: Write a program that lists the indexes of m sequences which has the highest frequencies.

Input specification
You will be first given four numbers:

  • the number of sequences (n),
  • two numbers (a - upper bound) and (b - lower bound)
  • the number of top sequences (m) to show
where 0 ≤ m ≤ n ≤ 2000 and 0 ≤ a ≤ b ≤ 50,000. Then in the following n lines, you will be given n sequences. Each line contains at most 1000 numbers ending with a sentinel value -999 where the numbers are between 0 and 50,000.

Output specification:
Show the frequencies of top m sequences.

Sample Input
7 8 1 3
3 15 14 17 20 13 10 -999
19 -999
19 2 10 2 -999
8 -999
8 6 9 14 -999
2 15 2 20 14 -999
14 1 6 15 1 6 2 16 7 7 -999
Sample Output
7 2 2

Explanation: There are 7 sequences given. And, we are searching the numbers between 1 and 8. In the first sequence, there is only one number between 1 and 8. And, there are 7 numbers between 1 and 8 on the seventh sequence. So, the following number of numbers exist in each of the sequence:

Sequence # Frequency
1 1
2 0
3 2
4 1
5 2
6 2
7 7



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

www.contester.ru