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 length n , consisting of lowercase Latin letters. You are allowed to replace at most one character in the string with an arbitrary lowercase Latin letter. Print the lexicographically minimal string that can be obtained from the original string and contains the maximum number of palindromes as substrings. Note that if a palindrome appears more than once as a substring, it is counted the same number of times it appears. The string a is lexicographically smaller than the string b if and only if one of the following holds: The first line contains one integer n ( 1 <= q n <= q 3 cdot 10^5 ) -- the number of characters in the string. The second line contains the string s itself, consisting of exactly n lowercase Latin letters. In the first line, print one integer -- the maximum number of palindromic substrings that can be obtained using the operation described in the statement at most once. In the second line, print the string that can be obtained from s and has the maximum possible number of palindromic substrings. If there are multiple answers, print the lexicographically smallest one. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
237865064 |
CJ_xde_lt |
F |
Dec. 19, 2023, 3:31 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
842 |
152473600 |
|
|
237817808 |
NoorusSamad |
F |
Dec. 18, 2023, 4:46 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
1123 |
242483200 |
|
|
237826235 |
Heart_Blue |
F |
Dec. 18, 2023, 5:45 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
374 |
149094400 |
|
|
237816610 |
Zy2 |
F |
Dec. 18, 2023, 4:40 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
498 |
129228800 |
|
|
237818708 |
Zy2 |
F |
Dec. 18, 2023, 4:51 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
545 |
98099200 |
|
|
237872627 |
old_wrp |
F |
Dec. 19, 2023, 5:27 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
670 |
154521600 |
|
|
237818858 |
El3ageed_Abu_Shehab |
F |
Dec. 18, 2023, 4:52 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
686 |
82636800 |
|
|
237819514 |
CJ-_zhuyifan |
F |
Dec. 18, 2023, 4:55 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
686 |
152473600 |
|
|
237819365 |
kh0i |
F |
Dec. 18, 2023, 4:54 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
748 |
72192000 |
|
|
237875062 |
2100030603.cseh |
F |
Dec. 19, 2023, 5:57 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
764 |
72192000 |
|
|
237848578 |
patou |
F |
Dec. 19, 2023, 12:23 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
1029 |
132505600 |
|
|
237821817 |
Soinix |
F |
Dec. 18, 2023, 5:10 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
1201 |
92364800 |
|
|
237816778 |
duanyuu |
F |
Dec. 18, 2023, 4:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
68 |
405 |
271052800 |
|
|
237817499 |
cxm1024 |
F |
Dec. 18, 2023, 4:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
68 |
421 |
90009600 |
|
|
237819650 |
zhiganov_v |
F |
Dec. 18, 2023, 4:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
68 |
623 |
87244800 |
|
|
237819473 |
zhiganov_v |
F |
Dec. 18, 2023, 4:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
68 |
1076 |
104140800 |
|
|
237820828 |
lethalboy |
F |
Dec. 18, 2023, 5:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
68 |
1200 |
120012800 |
|
|
237849980 |
MarcosK |
F |
Dec. 19, 2023, 1:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
68 |
1481 |
294707200 |
|
|
237873758 |
HOLlC |
F |
Dec. 19, 2023, 5:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
68 |
1996 |
273920000 |
|
|
237873220 |
HOLlC |
F |
Dec. 19, 2023, 5:35 a.m. |
OK |
GNU C++17 (64) |
TESTS |
68 |
2074 |
273920000 |
|
|
237869740 |
Bucketsmith |
F |
Dec. 19, 2023, 4:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
68 |
2215 |
120934400 |
|
|
237844371 |
abeker |
F |
Dec. 18, 2023, 9:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
249 |
71577600 |
|
|
237867983 |
2qbingxuan |
F |
Dec. 19, 2023, 4:23 a.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
249 |
81817600 |
|
|
237811339 |
Nguyen_Mai_Huong |
F |
Dec. 18, 2023, 4:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
249 |
88268800 |
|
|
237827885 |
Ormlis |
F |
Dec. 18, 2023, 5:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
265 |
134758400 |
|
|
237816988 |
LeXuanSon |
F |
Dec. 18, 2023, 4:41 p.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
280 |
75673600 |
|
|
237818181 |
Slamaa |
F |
Dec. 18, 2023, 4:48 p.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
374 |
242585600 |
|
|
237816330 |
Shikibe_Mayu |
F |
Dec. 18, 2023, 4:39 p.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
374 |
242585600 |
|
|
237824304 |
ghoul932 |
F |
Dec. 18, 2023, 5:29 p.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
389 |
106598400 |
|
|
237836719 |
chappy1 |
F |
Dec. 18, 2023, 7:37 p.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
390 |
242585600 |
|
|
237873334 |
fallleaves07 |
F |
Dec. 19, 2023, 5:37 a.m. |
OK |
GNU C++20 (64) |
TESTS |
68 |
405 |
80076800 |
|
|
237811388 |
arvindf232 |
F |
Dec. 18, 2023, 4:28 p.m. |
OK |
Kotlin 1.6 |
TESTS |
68 |
3088 |
162406400 |
|
|
237810799 |
arvindf232 |
F |
Dec. 18, 2023, 4:27 p.m. |
OK |
Kotlin 1.6 |
TESTS |
68 |
3197 |
162201600 |
|
|
remove filters
Back to search problems