You are given a sequence of integers and a number k, you have to output k sorted smallest numbers of this sequence.
There are several test cases, each test case start with two numbers n (1<=n<=1000000) and k (1<=k<=n). n is the size of sequence.
For each test case, output a sequence on a line.
5 3 8 3 9 3 100 10 2 10 9 8 7 6 5 4 3 2 1
3 3 8 1 2
Try to solve this problem in 5 minutes.
Migrated from old NTUJ.
No. | Testdata Range | Score |
---|