Sorting IDs
Time: 2 s
Memory: 125 MB
Memory: 125 MB
The EWU CSE Department was preparing for the EWU Intra Kickoff Contest. To organize the event efficiently, the organizers needed to sort the list of registered participants' student IDs.
Each participant’s ID, which contains their admission information, is in the format YYYY-S-60-NNN, where:
Each participant’s ID, which contains their admission information, is in the format YYYY-S-60-NNN, where:
- YYYY, the \(year\) of admission, is a 4-digit integer,
- S, the \(semester\) of admission, is a single digit (1 for Spring, 2 for Summer, 3 for Fall),
- 60 is the fixed department code (CSE), and
- NNN, the admission \(serial\), is a 3-digit integer (with leading zeros).
- By Semester (S): Spring first, then Summer, and Fall last.
- By Year (YYYY): Within the same semester, recent years should appear earlier.
- By Serial (NNN): If semester and year are the same, smaller serial numbers should come first.
Input
The first line contains an integer \(n\), the number of participants.The next \( n\) lines contain the student IDs.
Constraint
\(2 \leq n \leq 2 \times 10^5 \\ 1950\leq year\leq2024\\semester\in\{1, 2, 3\}\\ 1\leq serial\leq999\)
Output
Print the sorted IDs, each on a new line.
Examples
| Input | Output |
|---|---|
|
5
2020-1-60-010 2020-2-60-001 2022-1-60-001 2023-3-60-016 2023-3-60-011 |
2022-1-60-001
2020-1-60-010 2020-2-60-001 2023-3-60-011 2023-3-60-016 |
Notes
\(\hspace{0.6cm} \begin{array}{c@{\quad}c@{\quad}c} \begin{array}{l} \text{2020-}\color{Red}{1}\text{-60-010}\\ \text{2020-}\color{Green}{2}\text{-60-001}\\ \text{2022-}\color{Red}{1}\text{-60-001}\\ \text{2023-}\color{Blue}{3}\text{-60-016}\\ \text{2023-}\color{Blue}{3}\text{-60-011}\\ \end{array} & \xrightarrow{\text{Sorting by semester}} & \begin{array}{l} \text{2020-}\color{Red}{1}\text{-60-010}\\ \text{2022-}\color{Red}{1}\text{-60-001}\\[1.5mm] \text{2020-}\color{Green}{2}\text{-60-001}\\[1.5mm] \text{2023-}\color{Blue}{3}\text{-60-016}\\ \text{2023-}\color{Blue}{3}\text{-60-011}\\ \end{array} \end{array} \hspace{0.6cm} \)\(\hspace{0.6cm} \begin{array}{c@{\quad}c@{\quad}c} \begin{array}{l} \color{Red}{2020}\text{-1-60-010}\\ \color{Green}{2022}\text{-1-60-001}\\[1.5mm] \color{Red}{2020}\text{-2-60-001}\\[1.5mm] \color{Red}{2023}\text{-3-60-016}\\ \color{Red}{2023}\text{-3-60-011}\\ \end{array} & \xrightarrow{\text{Sorting by year}} & \begin{array}{l} \color{Green}{2022}\text{-1-60-001}\\[0.75mm] \color{Red}{2020}\text{-1-60-010}\\[1.5mm] \color{Red}{2020}\text{-2-60-001}\\[1.5mm] \color{Red}{2023}\text{-3-60-016}\\ \color{Red}{2023}\text{-3-60-011}\\ \end{array} \end{array} \hspace{0.6cm} \)
\(\hspace{0.6cm} \begin{array}{c@{\quad}c@{\quad}c} \begin{array}{l} \text{2022-1-60-}\color{Red}{001}\\[0.75mm] \text{2020-1-60-}\color{Red}{010}\\[1.5mm] \text{2020-2-60-}\color{Red}{001}\\[1.5mm] \text{2023-3-60-}\color{Red}{016}\\ \text{2023-3-60-}\color{Green}{011}\\ \end{array} & \xrightarrow{\text{Sorting by serial}} & \begin{array}{l} \text{2022-1-60-}\color{Red}{001}\\[0.75mm] \text{2020-1-60-}\color{Red}{010}\\[1.5mm] \text{2020-2-60-}\color{Red}{001}\\[1.5mm] \text{2023-3-60-}\color{Green}{011}\\[0.4mm] \text{2023-3-60-}\color{Red}{016}\\ \end{array} \end{array} \hspace{0.6cm} \)
Problem Info
| Problem ID | 373 |
| Time Limit | 2000 ms |
| Memory Limit | 128000 KB |
| Moderators | osama_bq , lauhemahfus , refred1 , amirhozaifa , tafsiruzzaman , meheraj_hossain_ , sagorahmedmunna , Rakib , Dr_KeK |
Statistics
Submit
You need to Login or Registration for submit your solution