2901. Big Number

单点时限: 10.0 sec

内存限制: 256 MB

Trillion, quadrillion, quintillion, sextillion, septillion, octillion — all is trifle! Vasya knows how to get a really big number. One should consider several “ordinary” numbers, and then write them down consequently one after another on a piece of paper.
Vasya decided to demonstrate this idea to his elder brother Pete. He prepared a sequence of N positive integers and started writing them down one after another on a piece of paper. After observing this process for a while, Pete got tired and suggested Vasya to solve the following puzzle.
Vasya’s goal is to remove exactly K numbers from his sequence so that if one concatenates the remaining numbers (keeping the original order) he gets the largest possible number. Please, help Vasya.


The first line contains two integers N and K denoting how many numbers are prepared by Vasya and how many of them should be removed, respectively (2 ≤ N ≤ 105, 1 ≤ K ≤ N − 1 and K ≤ 100). The second line contains N space separated positive integers not exceeding 109.


Please, output the largest possible number Vasya can obtain by removing exactly K numbers from the sequence.


5 2
123 37 45 9 18

7 人解决,23 人已尝试。

11 份提交通过,共有 72 份提交。

8.1 EMB 奖励。

创建: 8 年,8 月前.

修改: 2 年,5 月前.

最后提交: 2 年,4 月前.

来源: N/A