HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Questions 2016 > problem:


15-PE-4. 50868 - Sort Frequencies

CEN112 Questions 2016

Start: Mar.30.2016 at 03:10:22 PM
Finish: Apr.01.2016 at 05:00:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 15-MdtE-1. 50915 - Trip to Korca
• 15-MdtE-2. 50916 - Ascending Num...
• 15-MdtE-3. 50913 - Manhattan Distance
• 15-MdtE-4. 50917 - Descending Nu...
• 15-MdtE-5. 50912 - Trip to Librazhd
• 15-MdtE-6. 50914 - Buy 3, Pay 2
• 15-PE-1. 50865 - Apartment Building...
• 15-PE-2. 50866 - Buy the cheapest
• 15-PE-4. 50868 - Sort Frequencies
• 15-PE-5. 50869 - Birthday Celebration
• 15-PE-7. 50871 - Harmonic Mean
• 15-PE-8. 50872 - Top M Grades
• 15-PE2-1. 50980 - The smallest rect...
• 15-PE2-2. 50981 - Top popular m-st...
• 15-PE2-2. 50984 - Top m hardworki...
• 15-PE2-2. 51086 - Top popular student
• 15-PE2-3. 50982 - A thief in labyrinth

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