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
( 1702 ) E Clean Substrings PROGRAMMING combinatorics data structures math

A binary string (t) of length (m) is called clean if (t_i = t_{i+1}) for all (1\le i\lt m). The chief engineer of the country has made another discovery. He invented a smart robot that can perform the following operation on any binary string (t) for one coin: Choose any clean substring(^{\text{∗}}) of the string (t). Invert all elements of the substring (change (0) to (1) and vice versa). Define the beauty of a string (t) as the minimum number of coins needed to make it clean . Define the power of a string (t) as the sum of the beauties of all its substrings. You are given a binary string (s) of length (n). The engineer's competitors are going to modify the string exactly (q) times. Each modification is described by one number (i). After the modification, (s_i) is inverted. Your task is to compute the power of the string (s) before and after each modification. (^{\text{∗}})A string (a) is a substring of a string (b) if (a) can be obtained from (b) by the deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n) and (q) ((1\le n, q\le 2\cdot 10^5)) — the length of the binary string and the number of modifications. The second line of each test case contains the binary string (s). The next (q) lines of each test case contain one integer (i) ((1\le i\le n)) — the description of the modifications. It is guaranteed that the sum of all (n) values and the sum of all (q) values over all test cases do not exceed (2\cdot 10^5). For each test case, output (q + 1) integers separated by spaces — the answer before the modifications and after eac

Tutorials

157126

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
392070535 ELgago73 E Sept. 25, 2026, 4:49 p.m. OK C# 13 TESTS 30 187 7884800
392098123 hzhaholic E Sept. 26, 2026, 12:49 a.m. OK C++17 (GCC 7-32) TESTS 30 125 0
392070390 nobita69 E Sept. 25, 2026, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 30 125 0
392069854 Frosted_maze E Sept. 25, 2026, 4:47 p.m. OK C++17 (GCC 7-32) TESTS 30 125 0
392058962 sjmoey E Sept. 25, 2026, 4:16 p.m. OK C++17 (GCC 7-32) TESTS 30 125 0
392090299 10tin-nhat E Sept. 25, 2026, 8:56 p.m. OK C++17 (GCC 7-32) TESTS 30 125 1638400
392059121 MAHAKAL_JB E Sept. 25, 2026, 4:17 p.m. OK C++17 (GCC 7-32) TESTS 30 125 28057600
392112942 HoshiYougi E Sept. 26, 2026, 5:33 a.m. OK C++17 (GCC 7-32) TESTS 30 140 0
392112165 so_close_ E Sept. 26, 2026, 5:26 a.m. OK C++17 (GCC 7-32) TESTS 30 140 0
392110555 minhaduoi E Sept. 26, 2026, 5:09 a.m. OK C++17 (GCC 7-32) TESTS 30 140 0
392066957 SoftieFishy E Sept. 25, 2026, 4:39 p.m. OK C++17 (GCC 7-32) TESTS 30 140 0
392114977 ycy17 E Sept. 26, 2026, 5:50 a.m. OK C++20 (GCC 13-64) TESTS 30 78 0
392107111 irmuun E Sept. 26, 2026, 4:16 a.m. OK C++20 (GCC 13-64) TESTS 30 78 0
392092611 Sam_2027 E Sept. 25, 2026, 9:53 p.m. OK C++20 (GCC 13-64) TESTS 30 78 0
392060242 Mk_anJUN3 E Sept. 25, 2026, 4:20 p.m. OK C++20 (GCC 13-64) TESTS 30 78 0
392115217 Springboot E Sept. 26, 2026, 5:52 a.m. OK C++20 (GCC 13-64) TESTS 30 93 0
392111256 AYUSHXXXX E Sept. 26, 2026, 5:17 a.m. OK C++20 (GCC 13-64) TESTS 30 93 0
392108306 vio_vv E Sept. 26, 2026, 4:35 a.m. OK C++20 (GCC 13-64) TESTS 30 93 0
392103522 robotolev E Sept. 26, 2026, 2:59 a.m. OK C++20 (GCC 13-64) TESTS 30 93 0
392102694 ccj123 E Sept. 26, 2026, 2:37 a.m. OK C++20 (GCC 13-64) TESTS 30 93 0
392097407 nqhuy1405 E Sept. 26, 2026, 12:32 a.m. OK C++20 (GCC 13-64) TESTS 30 93 0
392058381 PiLoCode E Sept. 25, 2026, 4:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 62 3174400
392111877 omiisama E Sept. 26, 2026, 5:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 0
392104421 Queryme E Sept. 26, 2026, 3:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 0
392091468 Hiten_cp E Sept. 25, 2026, 9:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 0
392067181 MUSTAFA-MOHAMED E Sept. 25, 2026, 4:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 0
392065885 rudra.p.s.j E Sept. 25, 2026, 4:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 0
392064879 oshohaybalok E Sept. 25, 2026, 4:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 0
392064695 arcanery E Sept. 25, 2026, 4:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 716800
392094078 hodza E Sept. 25, 2026, 10:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 2560000
392117011 Koishi_114514 E Sept. 26, 2026, 6:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 93 0
392070845 kr1th1k E Sept. 25, 2026, 4:49 p.m. OK GNU C11 TESTS 30 1031 307200
392069188 sibanandsahu38 E Sept. 25, 2026, 4:46 p.m. OK GNU C11 TESTS 30 1046 1945600
392063435 turz0ahsan E Sept. 25, 2026, 4:29 p.m. OK Go TESTS 30 62 22118400
392086877 TripleM5da E Sept. 25, 2026, 7:53 p.m. OK Go TESTS 30 140 4915200
392106754 silicalet E Sept. 26, 2026, 4:09 a.m. OK Haskell TESTS 30 312 102400
392104101 neulfox E Sept. 26, 2026, 3:13 a.m. OK Haskell TESTS 30 312 102400
392062910 darshan_s_taskar E Sept. 25, 2026, 4:27 p.m. OK Java 21 TESTS 30 265 5529600
392061557 Sarthak1712 E Sept. 25, 2026, 4:23 p.m. OK Java 21 TESTS 30 265 6758400
392058159 rahulx1515 E Sept. 25, 2026, 4:14 p.m. OK Java 21 TESTS 30 296 2252800
392066062 kushagrakaneki E Sept. 25, 2026, 4:37 p.m. OK Java 21 TESTS 30 296 6246400
392065265 Pawan_IIIT_01 E Sept. 25, 2026, 4:34 p.m. OK Java 21 TESTS 30 328 921600
392064220 Abarna_t E Sept. 25, 2026, 4:31 p.m. OK Java 21 TESTS 30 546 29081600
392066275 Raj_coder E Sept. 25, 2026, 4:37 p.m. OK Java 21 TESTS 30 562 67788800
392096321 futureCM1 E Sept. 26, 2026, 12:07 a.m. OK Java 21 TESTS 30 593 6963200
392066924 AccidentallyAC E Sept. 25, 2026, 4:39 p.m. OK Java 21 TESTS 30 625 41984000
392063885 Night1324 E Sept. 25, 2026, 4:30 p.m. OK Java 8 TESTS 30 187 15462400
392066882 KamilIskhakov E Sept. 25, 2026, 4:39 p.m. OK Java 8 TESTS 30 500 0
392062357 yuvakumaran_r E Sept. 25, 2026, 4:26 p.m. OK Java 8 TESTS 30 687 0
392068518 akshaykumarpatil33 E Sept. 25, 2026, 4:44 p.m. OK Node.js TESTS 30 296 45260800
392058267 Mr.Jelly E Sept. 25, 2026, 4:14 p.m. OK PyPy 3-64 TESTS 30 203 20377600
392061055 Yash1927 E Sept. 25, 2026, 4:22 p.m. OK PyPy 3-64 TESTS 30 203 23756800
392073682 KidusMesfin E Sept. 25, 2026, 5:18 p.m. OK PyPy 3-64 TESTS 30 250 19968000
392063771 ecubic E Sept. 25, 2026, 4:30 p.m. OK PyPy 3-64 TESTS 30 265 15052800
392066994 XXJACK E Sept. 25, 2026, 4:39 p.m. OK PyPy 3-64 TESTS 30 265 26009600
392064872 aadibhav3 E Sept. 25, 2026, 4:33 p.m. OK PyPy 3-64 TESTS 30 265 40243200
392059394 murthy1e9 E Sept. 25, 2026, 4:17 p.m. OK PyPy 3-64 TESTS 30 281 18329600
392075800 jigitmax E Sept. 25, 2026, 5:36 p.m. OK PyPy 3-64 TESTS 30 281 23961600
392065845 devildestroyer812 E Sept. 25, 2026, 4:36 p.m. OK PyPy 3-64 TESTS 30 281 28876800
392073650 AdTerram E Sept. 25, 2026, 5:17 p.m. OK PyPy 3-64 TESTS 30 296 21299200
392062197 CandiceHe E Sept. 25, 2026, 4:25 p.m. OK Python 3 TESTS 30 312 24371200
392067869 vpiyush171 E Sept. 25, 2026, 4:42 p.m. OK Python 3 TESTS 30 312 42393600
392063657 sh20raj E Sept. 25, 2026, 4:30 p.m. OK Python 3 TESTS 30 343 39731200
392096352 i_DNB E Sept. 26, 2026, 12:08 a.m. OK Python 3 TESTS 30 375 47616000
392061255 Payoja E Sept. 25, 2026, 4:23 p.m. OK Python 3 TESTS 30 406 37785600
392066533 MayurPatil E Sept. 25, 2026, 4:38 p.m. OK Python 3 TESTS 30 640 13004800
392066461 amod_24 E Sept. 25, 2026, 4:38 p.m. OK Python 3 TESTS 30 640 13107200
392059433 maxeigenbrod E Sept. 25, 2026, 4:17 p.m. OK Python 3 TESTS 30 687 13312000
392058495 Sneha_anand21 E Sept. 25, 2026, 4:15 p.m. OK Python 3 TESTS 30 812 13107200
392063918 galiver2009 E Sept. 25, 2026, 4:30 p.m. OK Python 3 TESTS 30 843 13004800
392070779 chakrabanda E Sept. 25, 2026, 4:49 p.m. OK Rust 2021 TESTS 30 218 28569600
392062485 cvs-650 E Sept. 25, 2026, 4:26 p.m. OK Rust 2024 TESTS 30 312 40755200

remove filters

Back to search problems