Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan and Sidrit Reka.
Max Frequency
Question:
Your sister has a math homework. She has to find the max
frequency 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 greater
than or equal to the first number and smaller than or
equal to the second number.
Question: Write a program that finds
the index of the sequence which has the highest frequency.
Input specification
You will be first given three numbers: the number of
sequences, and two numbers (a-lower bound) and (b-upper bound)
where 0 ≤ n ≤ 2000 and -50,000 ≤ a ≤ b ≤ 50,000.
Then in the following n lines, you will be
given n sequences. Each line contains first a number k,
and the number of numbers in the sequence. Then on that line,
you will be given k numbers where 0 ≤ k ≤ 2000
and the numbers are between -50,000 and 50,000.
Output specification:
Show the index of the sequence with the max frequency
complying the given condition.
Note: If there are several sequences
with the same max frequency, show the index of the last
sequence.
Sample Input I
7 -3 5
5 -6 -1 -8 -4 -14
9 -1 5 -3 -8 8 -6 11 -5 -9
7 8 4 14 9 9 11 -13
10 9 -6 12 -11 15 -8 -11 8 7 1
6 15 14 -6 13 -3 3
8 6 1 -1 0 -9 -3 -3 -6
9 0 5 1 4 13 -11 -6 -8 -8
|
Sample Output I
6
|
Explanation: There are 7 sequences
given. And, we need to count the number of numbers which
are between -3 and 5. There is only one number between
a and b on the sequences: 1, 3 and 4. And, there are 5 numbers
between a and b on the sixth sequence: 1, -1, 0, -3, and -3.
Для отправки решений необходимо выполнить вход.
|