TSORT - Turbo Sort

no tags 

Given the list of numbers, you are to sort them in non decreasing order.

Input

t – the number of numbers in list, then t lines follow [t <= 10^6].
Each line contains one integer: N [0 <= N <= 10^6]

Output

Output given numbers in non decreasing order.

Example

Input:

5
5
3
6
7
1

Output:

1
3
5
6
7

hide comments
anhhh255: 2024-01-22 05:12:23

a little tip for Java user, merge sort is more than enough, but pay attention to your IO method aswell, i got AC using Scanner for input and BufferedWriter for output. I think BufferedReader for input would be better than Scanner but i got lazy.

duy2632001: 2023-03-02 10:51:07

<snip>
[Simes]: keep posting, I'll keep deleting

Last edit: 2023-03-03 08:15:35
duy2632001: 2023-03-02 10:32:45

<snip>
[Simes]: keep posting, I'll keep deleting

Last edit: 2023-03-03 08:15:42
duy2632001: 2023-03-02 10:31:58

<snip>
[Simes]: keep posting, I'll keep deleting

Last edit: 2023-03-03 08:15:54
krishp: 2020-04-24 20:51:52

You could just use .sort() or sorted() in python and AC this problem.

premtiw: 2019-12-06 12:11:33

if you're using C++; then make sure that you allow multiple elments of same thing.
example: 1,2,2,3,4,6,7,6
Here we have two 2s and two 6s.
If you're using set, only unique elemnsts are allowed and hence use multiset.

huy_samsung: 2019-07-02 10:59:47

i got NZEC error in java - i used merger sort - when i test - everything is ok. but when i submit - i got NZEC error

Last edit: 2019-07-02 11:04:24
imkiller: 2018-06-03 09:20:49

Just Write a merge sort!

anh_duc: 2018-04-18 14:27:28

Quick Sort got me AC in one go

code_aim: 2017-07-05 07:08:09

0.15s


Added by:Roman Sol
Date:2005-03-14
Time limit:2.700s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:ZCon