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"Congratulations, you have been accepted to the Master's Assistance Center! However, you were extremely bored in class and got tired of doing nothing, so you came up with a game for yourself. You are given a string s and an even integer n . There are two types of operations that you can apply to it: It is required to determine the lexicographically smallest ^{ dagger} string that can be obtained after applying exactly n operations. Note that you can apply operations of different types in any order, but you must apply exactly n operations in total. ^{ dagger} A string a is lexicographically smaller than a string b if and only if one of the following holds: Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 500 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single even integer n ( 2 <= q n <= q 10^9 ) -- the number of operations applied to the string s . The second line of each test case contains a single string s ( 1 <= q |s| <= q 100 ), consisting of lowercase English letters, -- the string to which the operations are applied. For each test case, output a single line -- the lexicographically smallest string that can be obtained after applying exactly n operations. In the first test case, you can apply the operation of the second type (i.e., reverse the string s ) 4 times. Then the string s will remain equal to cpm. In the second test case, you can do the following: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
249889366 |
shock_wav3 |
A |
March 6, 2024, 5:28 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249888747 |
__Tanzeel__ |
A |
March 6, 2024, 5:20 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249883977 |
silent_decoder |
A |
March 6, 2024, 4:14 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249883716 |
bikcrombiswas1234 |
A |
March 6, 2024, 4:10 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249883077 |
Muhammad11 |
A |
March 6, 2024, 4:01 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249882571 |
Say_Alhamdulillah |
A |
March 6, 2024, 3:52 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249882523 |
Saeed_Ahamed |
A |
March 6, 2024, 3:51 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249880090 |
pahad_charas_chai |
A |
March 6, 2024, 3:08 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249863753 |
Itssocooolyousonovabitch |
A |
March 5, 2024, 9:06 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249862652 |
jaber_ |
A |
March 5, 2024, 8:51 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
0 |
0 |
|
|
249890513 |
Unreval |
A |
March 6, 2024, 5:41 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249890350 |
Gzuh-k |
A |
March 6, 2024, 5:39 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249889816 |
de_Brogile |
A |
March 6, 2024, 5:33 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249889523 |
LittleLiya |
A |
March 6, 2024, 5:30 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249886995 |
Rombing |
A |
March 6, 2024, 4:57 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249886647 |
yw_sep |
A |
March 6, 2024, 4:53 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249886280 |
mee01 |
A |
March 6, 2024, 4:48 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249885730 |
sususy |
A |
March 6, 2024, 4:41 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249885679 |
SpadeA261 |
A |
March 6, 2024, 4:40 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249885333 |
Toxiccht |
A |
March 6, 2024, 4:36 a.m. |
OK |
C++17 (GCC 9-64) |
TESTS |
9 |
0 |
0 |
|
|
249892445 |
QuantumCoder_DG |
A |
March 6, 2024, 6:01 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
249892347 |
El_Gemmy |
A |
March 6, 2024, 6 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
249891914 |
0xaira.eth |
A |
March 6, 2024, 5:56 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
249891581 |
Yoshinow2001 |
A |
March 6, 2024, 5:52 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
249891515 |
Unknown_A |
A |
March 6, 2024, 5:52 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
249891473 |
LastToAC |
A |
March 6, 2024, 5:51 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
249891364 |
V_I_P |
A |
March 6, 2024, 5:50 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
249891310 |
five_v_five |
A |
March 6, 2024, 5:49 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
249890963 |
crystal_13 |
A |
March 6, 2024, 5:46 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
249890901 |
icovicky |
A |
March 6, 2024, 5:45 a.m. |
OK |
C++20 (GCC 11-64) |
TESTS |
9 |
0 |
0 |
|
|
remove filters
Back to search problems