Here is the
[1].
Code explanation: I am using a sorted linked list to sort the inputs. The numbers are sorted while inserted in the list.
For c++03 programmers, auto here is the same as node_type*
I have tested the results with a list of 10^6 numbers between 0 and 10^6 (0 and 1000000 are included) and the output is correct. So why does it keep giving me wrong answer?!?!?!
[1]: http://www.codechef.com/viewsolution/2427716