MERGSORT - Mergesort

Simple. Sort the numbers on the standard input using the merge sort algorithm. Don't try to cheat by just calling your build in functions... I can see your source.

Input

On the standard input you will receive N (1 <= N <= 100000). Each number will fit in 32-bit integer

Output

Output the same integers in a sorted manner. Smallest to largest.

Example

Input:
7 3 2 5 4 3

Output:
2 3 3 4 5 7

Added by:Nikola P Borisov
Date:2008-11-17
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET

hide comments
2024-06-17 09:38:05
here should we have to give input or it wil automatically takee
2021-08-30 19:17:05
I was getting the "Missing testcases: 'NoneT" error last week, I just submitted the same code today again and It worked!
2021-08-30 13:44:16 Robert Lewon
The "Missing testcases: 'NoneT" should no longer happen.
2021-08-22 10:19:37 Jean-Ralph Aviles
I get Missing testcases: 'NoneT. Anyone know what that means?
2019-01-25 12:16:20 Andy
easy
2018-05-29 08:49:47
I used mergesort and used " while( scanf("%d",&n) != EOF ) { a[i++] = n ; } " to take input
still getting TLE. can anyone help
2016-11-09 16:44:40
Can I use my own QuickSort?
2015-08-19 20:53:00
Those who using EOF carefully It do not work on console . It work with file input like online judges like spoj .

Last edit: 2015-11-20 14:35:11
2014-12-10 13:28:34 Rafiq
Runtime error why ?
2014-06-15 19:24:17 TIGM
good for learning merge sort :)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.