#P8082. [COCI 2011/2012 #4] KEKS

[COCI 2011/2012 #4] KEKS

Description

Given positive integers N,KN, K and an NN-digit number, find the maximum value of the number remaining after deleting KK digits from the NN-digit number.

Input Format

The first line contains two integers N,KN, K.

The second line contains an NN-digit integer. It is guaranteed to have no leading 00.

Output Format

Output the maximum value of the remaining number.

4 2
1924
94
7 3
1231234
3234
10 4
4177252841
775841

Hint

【Constraints】

  • For 50%50\% of the testdata, N1000N \le 1000.
  • For 100%100\% of the testdata, 1K<N5×1051 \le K \lt N \le 5 \times 10^5.

【Hints and Notes】

This problem is translated from COCI 2011-2012 CONTEST #4 Task 3 KEKS.

The score setting of this problem follows the original COCI problem, with a full score of 100100.

Translated by ChatGPT 5