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 have a positive number of length n and one additional digit. You can insert this digit anywhere in the number, including at the beginning or at the end. Your task is to make the result as large as possible. For example, you have the number 76543 , and the additional digit is 4 . Then the maximum number you can get is 765443 , and it can be obtained in two ways -- by inserting a digit after the 3 th or after the 4 th digit of the number. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The descriptions of the test cases follow. The first line of the description of each test case contains two integers n and d ( 1 <= n <= 2 cdot 10^5 ; 0 <= d <= 9 ) -- the length of the number and an additional digit, respectively. The second line of the description of each test case contains a string consisting of n digits -- the number that you have initially. It is guaranteed that the number does not contain leading zeros. It is guaranteed that the sum of n for all test cases does not exceed 2 cdot 10^5 . For each test case, output a string consisting of n + 1 digits -- the maximum possible number that can be obtained. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
200807286 |
Sh1ronamh1n |
A |
April 4, 2023, 8:54 p.m. |
OK |
C# 10 |
TESTS |
11 |
560 |
1638400 |
|
|
200811901 |
bluemegane |
A |
April 4, 2023, 10:17 p.m. |
OK |
C# 8 |
TESTS |
11 |
93 |
2457600 |
|
|
200811814 |
bluemegane |
A |
April 4, 2023, 10:15 p.m. |
OK |
C# 8 |
TESTS |
11 |
93 |
2457600 |
|
|
200811722 |
bluemegane |
A |
April 4, 2023, 10:12 p.m. |
OK |
C# 8 |
TESTS |
11 |
140 |
1945600 |
|
|
200785410 |
imsoumik03 |
A |
April 4, 2023, 5:12 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
3 |
155 |
7372800 |
|
|
200790396 |
alex123x1 |
A |
April 4, 2023, 5:55 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
3 |
156 |
7372800 |
|
|
200802744 |
rony652 |
A |
April 4, 2023, 7:53 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
11 |
187 |
7372800 |
|
|
200819674 |
sdfghujhjdf |
A |
April 5, 2023, 1:35 a.m. |
OK |
GNU C11 |
TESTS |
17 |
31 |
204800 |
|
|
200822040 |
M0r1arty |
A |
April 5, 2023, 2:27 a.m. |
OK |
GNU C11 |
TESTS |
17 |
31 |
204800 |
|
|
200784802 |
prajil22359 |
A |
April 4, 2023, 5:08 p.m. |
OK |
GNU C11 |
TESTS |
3 |
748 |
0 |
|
|
200803007 |
saif2107017 |
A |
April 4, 2023, 7:57 p.m. |
OK |
GNU C11 |
TESTS |
11 |
748 |
0 |
|
|
200802983 |
bkifhr8 |
A |
April 4, 2023, 7:57 p.m. |
OK |
GNU C11 |
TESTS |
11 |
748 |
0 |
|
|
200786970 |
MdKamrulhassan |
A |
April 4, 2023, 5:24 p.m. |
OK |
GNU C11 |
TESTS |
3 |
748 |
204800 |
|
|
200787795 |
MdKamrulhassan |
A |
April 4, 2023, 5:31 p.m. |
OK |
GNU C11 |
TESTS |
3 |
748 |
1024000 |
|
|
200786896 |
sanjay77 |
A |
April 4, 2023, 5:23 p.m. |
OK |
GNU C11 |
TESTS |
3 |
764 |
0 |
|
|
200809810 |
Radwan_ |
A |
April 4, 2023, 9:33 p.m. |
OK |
GNU C11 |
TESTS |
11 |
764 |
204800 |
|
|
200794292 |
kushagraagarwal789 |
A |
April 4, 2023, 6:36 p.m. |
OK |
GNU C11 |
TESTS |
11 |
780 |
204800 |
|
|
200791824 |
dacphu |
A |
April 4, 2023, 6:10 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
102400 |
|
|
200788137 |
fahmid07 |
A |
April 4, 2023, 5:34 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
15 |
0 |
|
|
200790393 |
20JE0975 |
A |
April 4, 2023, 5:55 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
15 |
0 |
|
|
200785260 |
pratts_02 |
A |
April 4, 2023, 5:11 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
15 |
0 |
|
|
200785183 |
thewarlock0001 |
A |
April 4, 2023, 5:11 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
15 |
0 |
|
|
200807196 |
omeganot |
A |
April 4, 2023, 8:53 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
|
200812703 |
sandra_emad |
A |
April 4, 2023, 10:35 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
|
200798415 |
repugnant |
A |
April 4, 2023, 7 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
0 |
|
|
200815479 |
Private268 |
A |
April 4, 2023, 11:49 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
102400 |
|
|
200810771 |
zwu2021016426 |
A |
April 4, 2023, 9:50 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
15 |
102400 |
|
|
200792377 |
Tadashii |
A |
April 4, 2023, 6:16 p.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
0 |
|
|
200787964 |
LeoMinor |
A |
April 4, 2023, 5:33 p.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
0 |
|
|
200786123 |
qiloudemao1 |
A |
April 4, 2023, 5:17 p.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
0 |
|
|
200784044 |
truong_8502 |
A |
April 4, 2023, 5:04 p.m. |
OK |
GNU C++17 |
TESTS |
3 |
0 |
0 |
|
|
200792625 |
jitendrapranto |
A |
April 4, 2023, 6:19 p.m. |
OK |
GNU C++17 |
TESTS |
3 |
15 |
0 |
|
|
200792170 |
Rahul_Nikhate |
A |
April 4, 2023, 6:14 p.m. |
OK |
GNU C++17 |
TESTS |
3 |
15 |
0 |
|
|
200792176 |
ritik.ttps25 |
A |
April 4, 2023, 6:14 p.m. |
OK |
GNU C++17 |
TESTS |
3 |
15 |
0 |
|
|
200809367 |
Waffle_ |
A |
April 4, 2023, 9:26 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
15 |
0 |
|
|
200799453 |
Gold_Dragon |
A |
April 4, 2023, 7:12 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
15 |
0 |
|
|
200808491 |
hegazy23 |
A |
April 4, 2023, 9:12 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
15 |
0 |
|
|
200788102 |
HCPS42 |
A |
April 4, 2023, 5:34 p.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
0 |
102400 |
|
|
200802197 |
N4_bo0 |
A |
April 4, 2023, 7:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
102400 |
|
|
200815024 |
Toka_hamdy |
A |
April 4, 2023, 11:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
15 |
102400 |
|
|
200805858 |
m7md_ashraf22 |
A |
April 4, 2023, 8:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
102400 |
|
|
200805306 |
Elvin_Fritl |
A |
April 4, 2023, 8:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
102400 |
|
|
200804833 |
MarcosK |
A |
April 4, 2023, 8:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
102400 |
|
|
200802244 |
m0nster.eXe |
A |
April 4, 2023, 7:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
102400 |
|
|
200802142 |
os-moussao |
A |
April 4, 2023, 7:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
102400 |
|
|
200802134 |
HitmanX97 |
A |
April 4, 2023, 7:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
102400 |
|
|
200794907 |
phisi |
A |
April 4, 2023, 6:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
102400 |
|
|
200790147 |
abanobRaffet |
A |
April 4, 2023, 5:53 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
0 |
|
|
200791039 |
UchihaMadara07 |
A |
April 4, 2023, 6:02 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
0 |
|
|
200783215 |
amirrrr |
A |
April 4, 2023, 4:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
0 |
|
|
200784555 |
78nine |
A |
April 4, 2023, 5:07 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
0 |
|
|
200785970 |
Anwar_Rizk |
A |
April 4, 2023, 5:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
0 |
|
|
200786667 |
Tanvir_Mahamood |
A |
April 4, 2023, 5:21 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
0 |
|
|
200786854 |
Lokendrakushwah12 |
A |
April 4, 2023, 5:23 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
0 |
|
|
200788726 |
yousefel_naggar |
A |
April 4, 2023, 5:40 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
0 |
|
|
200787250 |
beastboyshubh |
A |
April 4, 2023, 5:26 p.m. |
OK |
GNU C++20 (64) |
TESTS |
3 |
0 |
102400 |
|
|
200805065 |
vikram_kv |
A |
April 4, 2023, 8:24 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
0 |
102400 |
|
|
200822745 |
longsl |
A |
April 5, 2023, 2:40 a.m. |
OK |
Go |
TESTS |
17 |
31 |
1536000 |
|
|
200813733 |
ReedRay |
A |
April 4, 2023, 11 p.m. |
OK |
Go |
TESTS |
12 |
46 |
1433600 |
|
|
200782679 |
vijender_8601 |
A |
April 4, 2023, 4:56 p.m. |
OK |
Java 11 |
TESTS |
3 |
186 |
0 |
|
|
200791397 |
Extradict |
A |
April 4, 2023, 6:05 p.m. |
OK |
Java 11 |
TESTS |
3 |
217 |
0 |
|
|
200790181 |
pramodamballa |
A |
April 4, 2023, 5:53 p.m. |
OK |
Java 11 |
TESTS |
3 |
217 |
0 |
|
|
200800657 |
wat2 |
A |
April 4, 2023, 7:27 p.m. |
OK |
Java 11 |
TESTS |
11 |
218 |
0 |
|
|
200792619 |
ilasiawo |
A |
April 4, 2023, 6:19 p.m. |
OK |
Java 11 |
TESTS |
3 |
233 |
0 |
|
|
200804288 |
rishabhsehgal_ep20a6_01 |
A |
April 4, 2023, 8:14 p.m. |
OK |
Java 11 |
TESTS |
11 |
280 |
0 |
|
|
200822463 |
8484848 |
A |
April 5, 2023, 2:35 a.m. |
OK |
Java 11 |
TESTS |
17 |
311 |
0 |
|
|
200800596 |
NavneetKumar99 |
A |
April 4, 2023, 7:26 p.m. |
OK |
Java 11 |
TESTS |
11 |
327 |
0 |
|
|
200782389 |
durvesh03 |
A |
April 4, 2023, 4:54 p.m. |
OK |
Java 11 |
TESTS |
3 |
327 |
0 |
|
|
200833119 |
Saicharan_09 |
A |
April 5, 2023, 5:31 a.m. |
OK |
Java 11 |
TESTS |
17 |
358 |
204800 |
|
|
200792118 |
Suraj1607 |
A |
April 4, 2023, 6:13 p.m. |
OK |
Java 17 |
TESTS |
3 |
171 |
716800 |
|
|
200783289 |
Aaryendra |
A |
April 4, 2023, 4:59 p.m. |
OK |
Java 17 |
TESTS |
3 |
187 |
0 |
|
|
200827200 |
dhruv.p6 |
A |
April 5, 2023, 4 a.m. |
OK |
Java 17 |
TESTS |
17 |
187 |
307200 |
|
|
200814110 |
aruniscoding |
A |
April 4, 2023, 11:10 p.m. |
OK |
Java 17 |
TESTS |
12 |
218 |
512000 |
|
|
200820682 |
rmakash999 |
A |
April 5, 2023, 1:58 a.m. |
OK |
Java 17 |
TESTS |
17 |
280 |
614400 |
|
|
200828012 |
avinash_yekkaladevi |
A |
April 5, 2023, 4:14 a.m. |
OK |
Java 17 |
TESTS |
17 |
280 |
819200 |
|
|
200820848 |
rmakash999 |
A |
April 5, 2023, 2:01 a.m. |
OK |
Java 17 |
TESTS |
17 |
280 |
819200 |
|
|
200810173 |
OMAR-ARAB |
A |
April 4, 2023, 9:40 p.m. |
OK |
Java 17 |
TESTS |
11 |
280 |
1126400 |
|
|
200785050 |
CodeRonin |
A |
April 4, 2023, 5:10 p.m. |
OK |
Java 17 |
TESTS |
3 |
296 |
102400 |
|
|
200798842 |
ukk219167 |
A |
April 4, 2023, 7:05 p.m. |
OK |
Java 17 |
TESTS |
11 |
296 |
1433600 |
|
|
200831100 |
T_PAVAN_NAGARAJU |
A |
April 5, 2023, 5:04 a.m. |
OK |
Java 8 |
TESTS |
17 |
93 |
0 |
|
|
200826001 |
aashrithreddypeddi |
A |
April 5, 2023, 3:39 a.m. |
OK |
Java 8 |
TESTS |
17 |
93 |
0 |
|
|
200825942 |
Kenzhezhan |
A |
April 5, 2023, 3:38 a.m. |
OK |
Java 8 |
TESTS |
17 |
93 |
0 |
|
|
200782168 |
formidablechief_27 |
A |
April 4, 2023, 4:53 p.m. |
OK |
Java 8 |
TESTS |
3 |
93 |
0 |
|
|
200792374 |
FamAShihata |
A |
April 4, 2023, 6:16 p.m. |
OK |
Java 8 |
TESTS |
3 |
108 |
0 |
|
|
200827727 |
999ms_Clutch |
A |
April 5, 2023, 4:09 a.m. |
OK |
Java 8 |
TESTS |
17 |
139 |
0 |
|
|
200795793 |
youssef_ayman_ |
A |
April 4, 2023, 6:53 p.m. |
OK |
Java 8 |
TESTS |
11 |
156 |
0 |
|
|
200793900 |
aryankumar877 |
A |
April 4, 2023, 6:31 p.m. |
OK |
Java 8 |
TESTS |
11 |
171 |
38195200 |
|
|
200827158 |
anukul16 |
A |
April 5, 2023, 4 a.m. |
OK |
Java 8 |
TESTS |
17 |
202 |
0 |
|
|
200826350 |
anukul16 |
A |
April 5, 2023, 3:46 a.m. |
OK |
Java 8 |
TESTS |
17 |
217 |
0 |
|
|
200780412 |
FoxSay |
A |
April 4, 2023, 4:48 p.m. |
OK |
JavaScript |
TESTS |
3 |
77 |
1024000 |
|
|
200823751 |
NewPlayer169 |
A |
April 5, 2023, 2:58 a.m. |
OK |
Kotlin 1.7 |
TESTS |
17 |
483 |
14438400 |
|
|
200788519 |
Cesaro95 |
A |
April 4, 2023, 5:38 p.m. |
OK |
Kotlin 1.7 |
TESTS |
3 |
1013 |
16076800 |
|
|
200825204 |
stillnotyet |
A |
April 5, 2023, 3:24 a.m. |
OK |
Kotlin 1.7 |
TESTS |
17 |
1122 |
17100800 |
|
|
200813315 |
rastkos189 |
A |
April 4, 2023, 10:49 p.m. |
OK |
Mono C# |
TESTS |
11 |
420 |
3276800 |
|
|
200779052 |
tahmurazzz |
A |
April 4, 2023, 4:46 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
31 |
0 |
|
|
200785353 |
tatianyi |
A |
April 4, 2023, 5:12 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
31 |
102400 |
|
|
200829674 |
alex0511 |
A |
April 5, 2023, 4:43 a.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
31 |
614400 |
|
|
200824875 |
cz1137 |
A |
April 5, 2023, 3:19 a.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
31 |
819200 |
|
|
200783643 |
sauryagupta |
A |
April 4, 2023, 5:01 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
46 |
0 |
|
|
200831107 |
zyczyc0207 |
A |
April 5, 2023, 5:04 a.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
46 |
614400 |
|
|
200806671 |
Ahmed_El-Sayed_Mahmoud |
A |
April 4, 2023, 8:45 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
61 |
204800 |
|
|
200827034 |
Xingyunbo2009 |
A |
April 5, 2023, 3:58 a.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
61 |
614400 |
|
|
200820400 |
ratatouille99 |
A |
April 5, 2023, 1:52 a.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
61 |
614400 |
|
|
200778821 |
Surya50 |
A |
April 4, 2023, 4:45 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
62 |
0 |
|
|
200823068 |
Vishnu_Actual |
A |
April 5, 2023, 2:47 a.m. |
OK |
PyPy 3 |
TESTS |
17 |
374 |
8601600 |
|
|
200787876 |
Kl0_o |
A |
April 4, 2023, 5:32 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
374 |
9830400 |
|
|
200782975 |
Ankush_tonde |
A |
April 4, 2023, 4:57 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
389 |
8601600 |
|
|
200835064 |
call_me_atul |
A |
April 5, 2023, 5:57 a.m. |
OK |
PyPy 3 |
TESTS |
17 |
405 |
8499200 |
|
|
200821748 |
alpy123 |
A |
April 5, 2023, 2:20 a.m. |
OK |
PyPy 3 |
TESTS |
17 |
405 |
8499200 |
|
|
200794503 |
Nas |
A |
April 4, 2023, 6:38 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
405 |
9728000 |
|
|
200780599 |
duck_man123 |
A |
April 4, 2023, 4:49 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
421 |
9420800 |
|
|
200819677 |
udayan8 |
A |
April 5, 2023, 1:35 a.m. |
OK |
PyPy 3-64 |
TESTS |
17 |
93 |
6553600 |
|
|
200786948 |
AndreiZherder |
A |
April 4, 2023, 5:24 p.m. |
OK |
PyPy 3-64 |
TESTS |
3 |
93 |
7270400 |
|
|
200789024 |
isekun |
A |
April 4, 2023, 5:42 p.m. |
OK |
PyPy 3-64 |
TESTS |
3 |
93 |
7680000 |
|
|
200820141 |
Youarenotgood |
A |
April 5, 2023, 1:46 a.m. |
OK |
PyPy 3-64 |
TESTS |
17 |
93 |
8396800 |
|
|
200835210 |
I_Am_That |
A |
April 5, 2023, 5:59 a.m. |
OK |
PyPy 3-64 |
TESTS |
17 |
93 |
13824000 |
|
|
200828508 |
shock_wav3 |
A |
April 5, 2023, 4:22 a.m. |
OK |
PyPy 3-64 |
TESTS |
17 |
124 |
7884800 |
|
|
200830727 |
jamerrq |
A |
April 5, 2023, 4:59 a.m. |
OK |
PyPy 3-64 |
TESTS |
17 |
124 |
8089600 |
|
|
200804143 |
gardengnome |
A |
April 4, 2023, 8:12 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
8908800 |
|
|
200783934 |
rishabh.jaiswal |
A |
April 4, 2023, 5:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
3 |
140 |
9216000 |
|
|
200821075 |
ZrjaK |
A |
April 5, 2023, 2:06 a.m. |
OK |
PyPy 3-64 |
TESTS |
17 |
155 |
9318400 |
|
|
200804318 |
SBAGE |
A |
April 4, 2023, 8:14 p.m. |
OK |
Python 3 |
TESTS |
11 |
77 |
134963200 |
|
|
200789683 |
Angelawqy |
A |
April 4, 2023, 5:49 p.m. |
OK |
Python 3 |
TESTS |
3 |
124 |
307200 |
|
|
200835111 |
taruarora2605 |
A |
April 5, 2023, 5:58 a.m. |
OK |
Python 3 |
TESTS |
17 |
124 |
614400 |
|
|
200827784 |
Anil_kumar_18 |
A |
April 5, 2023, 4:10 a.m. |
OK |
Python 3 |
TESTS |
17 |
124 |
614400 |
|
|
200818900 |
t_rivero |
A |
April 5, 2023, 1:17 a.m. |
OK |
Python 3 |
TESTS |
17 |
124 |
614400 |
|
|
200782286 |
omanand |
A |
April 4, 2023, 4:54 p.m. |
OK |
Python 3 |
TESTS |
3 |
124 |
614400 |
|
|
200810058 |
Suman_Akanda |
A |
April 4, 2023, 9:38 p.m. |
OK |
Python 3 |
TESTS |
11 |
124 |
716800 |
|
|
200832856 |
Stan_Jason |
A |
April 5, 2023, 5:28 a.m. |
OK |
Python 3 |
TESTS |
17 |
124 |
921600 |
|
|
200829684 |
varuneshRA |
A |
April 5, 2023, 4:43 a.m. |
OK |
Python 3 |
TESTS |
17 |
124 |
2048000 |
|
|
200800937 |
PythonIsGodlike |
A |
April 4, 2023, 7:30 p.m. |
OK |
Python 3 |
TESTS |
11 |
139 |
512000 |
|
|
200823113 |
Kither |
A |
April 5, 2023, 2:47 a.m. |
OK |
Rust 2021 |
TESTS |
17 |
15 |
819200 |
|
|
200801542 |
Milrosen |
A |
April 4, 2023, 7:37 p.m. |
OK |
Rust 2021 |
TESTS |
11 |
78 |
307200 |
|
|
remove filters
Back to search problems