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 consisting of n characters. These characters are among the first k lowercase letters of the Latin alphabet. You have to perform n operations with the string. During the i -th operation, you take the character that initially occupied the i -th position, and perform one of the following actions with it: For example, suppose the initial string is test, k = 20 , and the sequence of operations is URLD. Then the string is transformed as follows: The result of performing the sequence of operations is saes. Given the string s and the value of k , find the lexicographically smallest string that can be obtained after applying a sequence of operations to s . The first line contains one integer t ( 1 <= t <= 1000 ) -- the number of test cases. Each test case consists of two lines. The first line contains two integers n and k ( 1 <= n <= 500 ; 2 <= k <= 26 ). The second line contains a string s consisting of n characters. Each character is one of the k first letters of the Latin alphabet (in lower case). For each test case, print one line containing the lexicographically smallest string that can be obtained from s using one sequence of operations. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
100059915 |
rainboy |
F |
Nov. 30, 2020, 5:55 p.m. |
OK |
GNU C11 |
TESTS |
40 |
1060 |
0 |
|
|
100057094 |
love_job |
F |
Nov. 30, 2020, 5:16 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
62 |
10035200 |
|
|
100063607 |
201831990439 |
F |
Nov. 30, 2020, 7:02 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
78 |
512000 |
|
|
100063451 |
201831990439 |
F |
Nov. 30, 2020, 6:59 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
78 |
614400 |
|
|
100057940 |
sh1194 |
F |
Nov. 30, 2020, 5:27 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
483 |
716800 |
|
|
100052099 |
Prabowo |
F |
Nov. 30, 2020, 4:34 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
499 |
716800 |
|
|
100061091 |
serotonin |
F |
Nov. 30, 2020, 6:14 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
639 |
116224000 |
|
|
100059163 |
RGB_ICPC2 |
F |
Nov. 30, 2020, 5:44 p.m. |
OK |
GNU C++11 |
TESTS |
40 |
1154 |
307200 |
|
|
100071113 |
andor0 |
F |
Nov. 30, 2020, 11:04 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
46 |
0 |
|
|
100071085 |
andor0 |
F |
Nov. 30, 2020, 11:02 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
46 |
0 |
|
|
100062207 |
andor0 |
F |
Nov. 30, 2020, 6:34 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
46 |
0 |
|
|
100062094 |
andor0 |
F |
Nov. 30, 2020, 6:32 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
46 |
0 |
|
|
100054460 |
andor0 |
F |
Nov. 30, 2020, 4:49 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
46 |
0 |
|
|
100055234 |
demoralizer |
F |
Nov. 30, 2020, 4:55 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
46 |
204800 |
|
|
100068535 |
Diazzz |
F |
Nov. 30, 2020, 9 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
732 |
13414400 |
|
|
100082416 |
couplefire |
F |
Dec. 1, 2020, 5:26 a.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
0 |
|
|
100060755 |
P500 |
F |
Nov. 30, 2020, 6:09 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
0 |
|
|
100060505 |
tiankonguse |
F |
Nov. 30, 2020, 6:05 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
0 |
|
|
100054510 |
seeubh |
F |
Nov. 30, 2020, 4:49 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
0 |
|
|
100043407 |
Is1500EnoughForEGOI |
F |
Nov. 30, 2020, 4:14 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
0 |
|
|
100071854 |
timf1089 |
F |
Nov. 30, 2020, 11:51 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
204800 |
|
|
100066579 |
Mehrdad_Sohrabi |
F |
Nov. 30, 2020, 8:05 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
204800 |
|
|
100053665 |
Lixiaoban |
F |
Nov. 30, 2020, 4:43 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
204800 |
|
|
100049443 |
hank55663 |
F |
Nov. 30, 2020, 4:29 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
204800 |
|
|
100045078 |
Anonymous_Noob |
F |
Nov. 30, 2020, 4:18 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
46 |
204800 |
|
|
100046099 |
stevenkplus |
F |
Nov. 30, 2020, 4:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
31 |
102400 |
|
|
100060528 |
fivefourthreeone |
F |
Nov. 30, 2020, 6:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
0 |
|
|
100060403 |
fivefourthreeone |
F |
Nov. 30, 2020, 6:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
0 |
|
|
100060216 |
Heltion |
F |
Nov. 30, 2020, 6 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
0 |
|
|
100044226 |
Heltion |
F |
Nov. 30, 2020, 4:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
0 |
|
|
100068307 |
EIKOU |
F |
Nov. 30, 2020, 8:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
102400 |
|
|
100068219 |
EIKOU |
F |
Nov. 30, 2020, 8:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
102400 |
|
|
100048576 |
wrinx |
F |
Nov. 30, 2020, 4:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
204800 |
|
|
100074381 |
qazswedx2 |
F |
Dec. 1, 2020, 1:57 a.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
62 |
102400 |
|
|
100060338 |
fivefourthreeone |
F |
Nov. 30, 2020, 6:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
140 |
0 |
|
|
100046594 |
pichulia |
F |
Nov. 30, 2020, 4:22 p.m. |
OK |
MS C++ 2017 |
TESTS |
40 |
156 |
47411200 |
|
|
100054299 |
azukun |
F |
Nov. 30, 2020, 4:47 p.m. |
OK |
.NET Core C# |
TESTS |
40 |
1434 |
10137600 |
|
|
remove filters
Back to search problems