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 |
Для отправки решений необходимо выполнить вход.
|