HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50868 - Sort Frequencies

Guest
• Review clarifications (1)

Volume problems

• 50524 - Elevator
• 50751 - The biggest Minute
• 50468 - Draw Matrix - 2
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon
• 50835 - Club Presidency
• 50526 - Gold Market
• 50872 - Top M Grades
• 50868 - Sort Frequencies
• 50405 - Accounts Receivable
• 50377 - kth Permutation
• 50908 - Buy 1 Get 1
• 50906 - The Smallest Pair
• 51043 - Genome Sequencing
• 51042 - The most frequent k-mer
• 50657 - Permutations and Combinat...
• 51246 - Swap largest word, reverse ...

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