Tuenti Challenge 4

Challenge 1 - Anonymous Poll

Your university wants you to fill out an “anonymous” survey. There are many questions but some fields are mandatory:

  • Gender
  • Age
  • Education
  • Academic Year

Are you sure this is really anonymous? If you have a list of all students and you ask them to take a random survey, you may be able to identify the students who complete the survey.

The list of students is a text file. Each line has the information of a student in comma-separated values:


The gender can be “M” (male) or “F” (female).


Input starts with a number “T” (T <= 100) followed by “T” cases. Each case is a list of comma-separated values, which are:



For each case, you must print the list of students that match the input. If there are multiple results, print them in lexicographical order and separated by commas. If there are not matches, print “NONE”.

Use the following format:

Case #Ti: Ri

Where “Ti” is the case number and “Ri” is the result.

Sample input

M,21,Human Resources Management,3
F,20,Systems Engineering,2
M,20,Manufacturing Engineering,3
M,18,Electrical Engineering,4
F,25,Construction Engineering,4

Sample output

Case #1: NONE
Case #2: Morgan Martinez Moore
Case #3: Alfie Hernandez Diaz
Case #4: Mohammad Green Morales,Oliver Carter Rivera
Case #5: Ellie Brown Reed,Laura Stewart Foster,Nicole Peterson Torres

Problem stats

Completion time: 10 percentile: 1:06 h
90 percentile: 43:51 h
Submit exec time: min: 0.19 s
10 percentile: 0.65 s
90 percentile: 2.47 s
max: 1205.00 s
Test tries: min: 1
10 percentile: 1
90 percentile: 32
max: 179
# of completions:517