Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You are given a string s of lowercase Latin letters. The following operation can be used: And you are given the integer k -- the maximum number of operations that can be performed. Find the minimum lexicographically possible string that can be obtained by performing no more than k operations. The string a=a_1a_2 ... a_n is lexicographically smaller than the string b = b_1b_2 ... b_n if there exists an index k ( 1 <= k <= n ) such that a_1=b_1 , a_2=b_2 , ..., a_{k-1}=b_{k-1} , but a_k < b_k . The first line contains a single integer t ( 1 <= t <= 10^4 ) --the number of test cases in the test. This is followed by descriptions of the test cases. The first line of each test case contains two integers n and k ( 1 <= n <= 2 cdot 10^5 , 1 <= k <= 10^9 ) -- the size of the string s and the maximum number of operations that can be performed on the string s . The second line of each test case contains a string s of length n consisting of lowercase Latin letters. It is guaranteed that the sum n over all test cases does not exceed 2 cdot 10^5 . For each test case, output the lexicographically minimal string that can be obtained from the string s by performing no more than k operations. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
156013332 |
cheese-cracker |
E |
May 5, 2022, 5:36 p.m. |
OK |
D |
TESTS |
55 |
62 |
6144000 |
|
|
remove filters
Back to search problems