Description
The student secretary Mr.Takeshi Kovacs, of a college fest ”Dazzling Festival of Science”, has a big task of allotting coordinators in different domains.
However, he is afraid that the work may not be efficiently done when two people become friends or a couple. While he can never exclude this possibility, he
frames few rules for coordinators so that they are less likely to be best buddies.
1. Their age differs by at least 3 years
2. They are of the same gender 😉
3. They have different mother tongue
4. They have same CGPA (Since they are more likely to have competition
between them)
So, to allocate any two coordinators, Mr.Kovacs has to make sure they satisfy at least one among the above rules. Find out the maximum number of
coordinators he can select, given all this information.
2 Input Format
The first line consist of number of testcases (T). The first line of each testcase
contain number of coordinators (N). Next, there will be N rows containing four
space separated data1. Age
2. Gender
3. Mother tongue language
4. CGPA
1
3 Output Format
For each test case in the input, print the maximum number of eligible coordinators.
4 Constraints
Number of testcases, T ≤ 100
Number of coordinators, N ≤ 500
CGPA (non-negative integer), C ≤ 10
Age (positive integer), A ≤ 100
Gender (Character), S ∈ {M, F}
Mother tongue (String), M
5 Sample Testcase
Input:
2
4
19 M Marathi 8
17 M Telugu 10
20 M Telugu 5
19 F Telugu 6
8
16 M Bengali 8
27 F Telugu 8
19 M Telugu 9
17 M Marathi 8
22 M Marathi 7
17 M Telugu 9
18 F Bengali 9
23 M Bengali 7
Output:
3
7
6 Design submission format
For the design submission on Moodle, please submit tar.gz file named as your
roll number.
2