Codeforces Round 1123 (Div. 2)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
2267 Codeforces Round 1123 (Div. 2) FINISHED False 8100 833066 Sept. 25, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 17918 ) A Turn Into a Palindrome PROGRAMMING greedy strings

Ali has a string (s) consisting of (n) lowercase Latin letters. He also has a character (c), which is a lowercase Latin letter. In one coin, he can perform the following operation on the string (s): First, he chooses an index (1\le i\le n). Then he replaces (s_i) with the character (c). Ali wants to turn the string (s) into a palindrome(^{\text{∗}}), but he does not want to spend too many coins on it. Your task — compute the minimum number of coins he has to spend to turn the string (s) into a palindrome. (^{\text{∗}})A string (t) of length (m) is a palindrome if (t_i = t_{m-i+1}) holds for every (1\le i\le m) Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first line of each test case contains an integer (n) and a lowercase Latin letter (c) ((1\le n\le 100)) — the length of the string (s) and the character (c). The second line of each test case contains the string (s) consisting of (n) lowercase Latin letters. For each test case, output one number — the minimum number of coins Ali needs to spend for the string to become a palindrome. In the first test case, in one coin, you can replace (s_3) with (b). After the replacement, the string becomes (abba), which is already a palindrome. It can be proven that (1) is the minimum number of coins required. In the second test case, the string (s) is already a palindrome. In the third test case, it is enough to change (s_1) and (s_5) to (e). After two replacements, the string becomes (ebcbe), which is already a palindrome. In the fourth test case, in two coins, you can replace (s_1) and (s_7).

Tutorials

157126

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
392075352 FreshProgrammer A Sept. 25, 2026, 5:32 p.m. OK C# 13 TESTS 3 46 0
392081024 yadavchandrasen314 A Sept. 25, 2026, 6:30 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392079419 BugSlayer_123 A Sept. 25, 2026, 6:13 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392078307 wivn A Sept. 25, 2026, 6:01 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392075053 290 A Sept. 25, 2026, 5:30 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392074257 Rohan_gohil A Sept. 25, 2026, 5:23 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392072274 DivyanshG09 A Sept. 25, 2026, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392068259 Viraatg A Sept. 25, 2026, 4:43 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392066771 laban_bgp A Sept. 25, 2026, 4:39 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392066007 Yogant A Sept. 25, 2026, 4:36 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392063168 balumeduri A Sept. 25, 2026, 4:28 p.m. OK C++17 (GCC 7-32) TESTS 3 0 0
392111149 18shenoy A Sept. 26, 2026, 5:16 a.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392087369 frenchfry_supreme A Sept. 25, 2026, 8 p.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392079485 3B3ATY A Sept. 25, 2026, 6:13 p.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392078210 PratinavGupta A Sept. 25, 2026, 6 p.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392075471 KrishnaForNow A Sept. 25, 2026, 5:33 p.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392073480 amirjr A Sept. 25, 2026, 5:16 p.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392073217 ar_paixaos19 A Sept. 25, 2026, 5:14 p.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392072421 souchith07 A Sept. 25, 2026, 5:09 p.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392069621 Teja-Smart A Sept. 25, 2026, 4:47 p.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392068686 Mostafa-Alkhateeb A Sept. 25, 2026, 4:44 p.m. OK C++20 (GCC 13-64) TESTS 3 0 0
392083658 praneethexe A Sept. 25, 2026, 7:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392081572 ddbjiang A Sept. 25, 2026, 6:37 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392080613 N.M.G-07 A Sept. 25, 2026, 6:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392080464 kirill323223 A Sept. 25, 2026, 6:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392080327 itzdeinj13 A Sept. 25, 2026, 6:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392079461 ggyongyi A Sept. 25, 2026, 6:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392078201 Spectonifier A Sept. 25, 2026, 6 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392077735 DhawalRastogi07 A Sept. 25, 2026, 5:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392077443 chetankalla270906 A Sept. 25, 2026, 5:53 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392077420 herin2301 A Sept. 25, 2026, 5:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 0 0
392073327 monk3468 A Sept. 25, 2026, 5:15 p.m. OK GNU C11 TESTS 3 0 0
392072758 vnq A Sept. 25, 2026, 5:11 p.m. OK GNU C11 TESTS 3 0 0
392069748 ishitag07 A Sept. 25, 2026, 4:47 p.m. OK GNU C11 TESTS 3 0 0
392063672 Parth_Nigam A Sept. 25, 2026, 4:30 p.m. OK GNU C11 TESTS 3 0 0
392087743 snaps4015 A Sept. 25, 2026, 8:07 p.m. OK GNU C11 TESTS 3 15 0
392087705 _dr.doom_ A Sept. 25, 2026, 8:06 p.m. OK GNU C11 TESTS 3 15 0
392086748 Kawsar3354802 A Sept. 25, 2026, 7:50 p.m. OK GNU C11 TESTS 3 15 0
392079520 cycmac8793 A Sept. 25, 2026, 6:14 p.m. OK GNU C11 TESTS 3 15 0
392077679 Nahidul_Islam_23 A Sept. 25, 2026, 5:55 p.m. OK GNU C11 TESTS 3 15 0
392068388 rejectedpiece2007 A Sept. 25, 2026, 4:43 p.m. OK GNU C11 TESTS 3 15 0
392106665 silicalet A Sept. 26, 2026, 4:07 a.m. OK Haskell TESTS 3 31 102400
392061308 DevanshSingh... A Sept. 25, 2026, 4:23 p.m. OK Java 21 TESTS 3 156 0
392060871 Abarna_t A Sept. 25, 2026, 4:21 p.m. OK Java 21 TESTS 3 156 0
392087412 ezyabhinav_001 A Sept. 25, 2026, 8:01 p.m. OK Java 21 TESTS 3 156 614400
392091068 Noobster786 A Sept. 25, 2026, 9:10 p.m. OK Java 21 TESTS 3 171 0
392067266 MaheshwariBK A Sept. 25, 2026, 4:40 p.m. OK Java 21 TESTS 3 171 0
392057727 techbro815 A Sept. 25, 2026, 4:13 p.m. OK Java 21 TESTS 3 171 409600
392080133 manjit_0604 A Sept. 25, 2026, 6:20 p.m. OK Java 21 TESTS 3 171 614400
392096858 goalboy A Sept. 26, 2026, 12:20 a.m. OK Java 21 TESTS 3 171 819200
392064298 Hitesh_2005 A Sept. 25, 2026, 4:31 p.m. OK Java 21 TESTS 3 171 819200
392073347 wealthy_sahil A Sept. 25, 2026, 5:15 p.m. OK Java 21 TESTS 3 171 1331200
392066689 harsh.sharma.gs25 A Sept. 25, 2026, 4:38 p.m. OK Java 8 TESTS 3 62 0
392059069 a_man_up A Sept. 25, 2026, 4:16 p.m. OK Java 8 TESTS 3 62 0
392088639 abhinavgupta333 A Sept. 25, 2026, 8:23 p.m. OK Java 8 TESTS 3 78 0
392107131 banana321 A Sept. 26, 2026, 4:16 a.m. OK Java 8 TESTS 3 109 0
392084134 siddhunethala A Sept. 25, 2026, 7:11 p.m. OK Java 8 TESTS 3 109 0
392066836 hitanshramtani A Sept. 25, 2026, 4:39 p.m. OK Java 8 TESTS 3 109 0
392112735 Vishalll_ A Sept. 26, 2026, 5:31 a.m. OK Java 8 TESTS 3 125 0
392085744 tharun.mokka564 A Sept. 25, 2026, 7:34 p.m. OK Java 8 TESTS 3 125 0
392083902 Priyanshi_Vishwakarma A Sept. 25, 2026, 7:08 p.m. OK Java 8 TESTS 3 125 0
392061146 kit29.25bad174 A Sept. 25, 2026, 4:22 p.m. OK Java 8 TESTS 3 125 0
392084581 MMinusZero A Sept. 25, 2026, 7:17 p.m. OK Node.js TESTS 3 62 1228800
392061876 RONIT_X A Sept. 25, 2026, 4:24 p.m. OK PyPy 3 TESTS 3 109 4096000
392084556 xtynct A Sept. 25, 2026, 7:17 p.m. OK PyPy 3 TESTS 3 125 3891200
392097118 mo-hit A Sept. 26, 2026, 12:26 a.m. OK PyPy 3 TESTS 3 140 5427200
392059551 nekobloomby A Sept. 25, 2026, 4:18 p.m. OK PyPy 3-64 TESTS 3 46 1536000
392068099 kcken A Sept. 25, 2026, 4:42 p.m. OK PyPy 3-64 TESTS 3 46 2048000
392103022 lu2m1n A Sept. 26, 2026, 2:45 a.m. OK PyPy 3-64 TESTS 3 46 2764800
392101926 golomb A Sept. 26, 2026, 2:19 a.m. OK PyPy 3-64 TESTS 3 46 2764800
392090626 adema05 A Sept. 25, 2026, 9:03 p.m. OK PyPy 3-64 TESTS 3 46 2867200
392070171 garvitwasson A Sept. 25, 2026, 4:48 p.m. OK PyPy 3-64 TESTS 3 46 2867200
392081596 pranav_deshmukh6 A Sept. 25, 2026, 6:37 p.m. OK PyPy 3-64 TESTS 3 62 1536000
392109814 sash070 A Sept. 26, 2026, 4:58 a.m. OK PyPy 3-64 TESTS 3 62 2048000
392113164 Friedrich A Sept. 26, 2026, 5:35 a.m. OK PyPy 3-64 TESTS 3 62 2150400
392069179 amirulrahaman183 A Sept. 25, 2026, 4:46 p.m. OK PyPy 3-64 TESTS 3 62 2252800
392089700 Sreejit72 A Sept. 25, 2026, 8:43 p.m. OK Python 3 TESTS 3 15 0
392085107 bo7mid2006 A Sept. 25, 2026, 7:24 p.m. OK Python 3 TESTS 3 15 0
392077150 Nishant_IITD A Sept. 25, 2026, 5:50 p.m. OK Python 3 TESTS 3 15 0
392075846 deepteshrout2294 A Sept. 25, 2026, 5:37 p.m. OK Python 3 TESTS 3 15 0
392061831 GHamster A Sept. 25, 2026, 4:24 p.m. OK Python 3 TESTS 3 15 0
392061154 mayankkestwal8 A Sept. 25, 2026, 4:22 p.m. OK Python 3 TESTS 3 15 0
392115018 abhirambhogi A Sept. 26, 2026, 5:50 a.m. OK Python 3 TESTS 3 31 0
392109856 helLo_woRld12 A Sept. 26, 2026, 4:58 a.m. OK Python 3 TESTS 3 31 0
392077604 himanshupraja59 A Sept. 25, 2026, 5:54 p.m. OK Python 3 TESTS 3 31 0
392075997 ramnathkumarmahto A Sept. 25, 2026, 5:39 p.m. OK Python 3 TESTS 3 31 0
392073412 m397 A Sept. 25, 2026, 5:16 p.m. OK Rust 2024 TESTS 3 31 0
392058052 PriyanshuX A Sept. 25, 2026, 4:14 p.m. OK Rust 2024 TESTS 3 31 0

remove filters

Back to search problems