[BOJ 9357] Eligibility

View as PDF

Submit solution

Points: 2
Time limit: 1.0s
Memory limit: 128M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

Regional Contest Director Osama Ismail knows that an individual cannot participate in the regional contest more than 5 times. Given a list of contestant names and the previous years they participated in, print which contestant is eligible.

입력 형식

The first line of the input contains a single integer T representing the number of the test cases</p>

The first line of each test case contains a single integer N

N lines follow in this test case each having the format "Name Year" denoting that contestant Name participated in a regional contest in year Year

  • T ≤ 100
  • 0 ≤ N ≤ 500
  • Name is sequence of lowercase English letters, spaces and contains up to 20 characters 
  • 1970 ≤ Year ≤ 2070

Note that since he collected the data from multiple sources it may contain duplicate records (if a contestant X have competed in year Y, you might find multiple lines "X Y" in the same test case)

출력 형식

For each test case, print a line containing the test case number as formatted in the sample and then for each eligible contestant print his\her name on a single line and note that you must print the names of the contestants in lexicographic order

예제 입력

1
6
ahmed 2010
ahmed 2011
ahmed 2009
ahmed 2008
ahmed 2005
mohamed 2001

예제 출력

Case #1:
mohamed

Comments

There are no comments at the moment.