APC2shake!
InterviewTime limit2sMemory limit1024 MB
Pick up to 10 enrolled participants with no ICPC award and no past shake! top-3 finish, ranked by 2024 APC placement, and list their names sorted.
- Level
Easy3 of 10
- Topics
- Sorting, Implementation
- Solved
- No attempts yet
Problem
At the 2024 Ajou University Programming Contest (2024 APC) Division 1, participants with strong results earn tickets to the 2024 Gyeongin Regional Six-University Programming Contest (2024 shake!). Qualifiers for 2024 shake! are selected by the following rules.
- Currently enrolled undergraduate students of Ajou University
- Not a past winner of the International Collegiate Programming Contest (ICPC)
- Not a past top-3 winner of shake!
- Among participants who satisfy the three rules above, up to participants with the best 2024 APC results
Given the names, enrollment status, past ICPC award status, best past shake! placement, and 2024 APC results of all participants, find the qualifiers for 2024 shake!.
Input
The first line contains the number of participants .
The next lines each contain the following information in this order, separated by spaces.
- Name: a string of lowercase English letters with no spaces. The length of the name does not exceed .
- Enrollment status:
jaehakif the participant is currently enrolled,hewhakif on leave. - Past ICPC award status:
winnerif the participant has won an ICPC award,notyetif not. - Best past shake! placement: an integer , the best placement the participant has ever achieved in shake!. means the participant has never qualified for shake!.
- 2024 APC result: an integer , the final placement in the 2024 APC.
More than one participant may have the same name. No two participants have the same 2024 APC placement.
Output
The first line prints the number of qualifiers who can take part in 2024 shake!.
The next lines print the names of the qualifiers in lexicographic order.