Starting from:
$30

$24

A8 Solution

Hackerrank Link: https://www.hackerrank.com/cs2810-ooaia-a8




Problem Statement



The student secretary Mr.Takeshi Kovacs, of a college fest "Dazzling Festi-val of Science", has a big task of allotting coordinators in di erent domains. However, he is afraid that the work may not be e ciently done when two peo-ple 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.




Their age di ers by at least 3 years



They are of the same gender ;)



They have di erent mother tongue



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 sat-isfy at least one among the above rules. Find out the maximum number of coordinators he can select, given all this information.




Input Format



The rst line consist of number of testcases (T). The rst line of each testcase contain number of coordinators (N). Next, there will be N rows containing four space separated data-




Age



Gender



Mother tongue language



CGPA






1












Output Format



For each test case in the input, print the maximum number of eligible coordi-nators.




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 2 fM; F g

Mother tongue (String), M




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




Design submission format



For the design submission on Moodle, please submit tar.gz le named as your roll number.



















2

More products