#P1271. Sorted Ballot Election
Sorted Ballot Election
Sorted Ballot Election
The school is holding an election for the student union. There are \(n\) candidates (with \(n \leq 999\)) numbered from 1 to \(n\). A total of \(m\) ballots (with \(m \leq 2000000\)) have been collected, and each ballot contains the number of the candidate voted for. Your task is to sort the ballots in ascending order based on the candidate numbers.
Input Format: The first line contains two integers, \(n\) and \(m\). The second line contains \(m\) integers, each representing a ballot vote (a candidate number between 1 and \(n\)).
Output Format: Output the ballot numbers sorted in ascending order, separated by a single space.
inputFormat
The first line of input contains two integers \(n\) and \(m\), where \(n\) (\(1 \leq n \leq 999\)) is the number of candidates and \(m\) (\(1 \leq m \leq 2000000\)) is the number of ballots.
The second line contains \(m\) integers, each denoting the candidate number written on a ballot.
outputFormat
Output the sorted ballot numbers in ascending order in one line. Each number should be separated by a single space.
sample
5 7
3 1 2 5 3 2 4
1 2 2 3 3 4 5