Codeforces Round 1025 (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
2109 Codeforces Round 1025 (Div. 2) FINISHED False 8100 28913123 May 17, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1757 ) E Binary String Wowee PROGRAMMING combinatorics dp strings

Mouf is bored with themes, so he decided not to use any themes for this problem. You are given a binary(^{\text{∗}}) string (s) of length (n). You are to perform the following operation exactly (k) times: select an index (i) ((1 \le i \le n)) such that (s_i = \mathtt{0}); then flip(^{\text{†}}) each (s_j) for all indices (j) ((1 \le j \le i)). You need to count the number of possible ways to perform all (k) operations. Since the answer could be ginormous, print it modulo (998\,244\,353). Two sequences of operations are considered different if they differ in the index selected at any step. (^{\text{∗}})A binary string is a string that consists only of the characters (\mathtt{0}) and (\mathtt{1}). (^{\text{†}})Flipping a binary character is changing it from (\mathtt{0}) to (\mathtt{1}) or vice versa. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 100)). The description of the test cases follows. The first line of each test case contains two integers (n) and (k) ((1 \le k \le n \le 500)) — the length of the binary string (s) and the number of times the operation must be performed, respectively. The second line of each test case contains a binary string (s) of length (n) consisting of only characters (\mathtt{0}) and (\mathtt{1}). It is guaranteed that the sum of (n) does not exceed (500) over all test cases. For each test case, output a single integer — the number of ways you can perform exactly (k) operations, modulo (998\,244\,353). In the first test case, here are all the possible sequences of operations: (\mathtt{\color{red}{0}10} \xrightarrow{i = 1} \mathtt{110}) (\mathtt{\color{red}{010}} \xrightarrow{i = 3} \mathtt{101}) In the second test case, here are all the possible sequences of operations: $$$\mathtt{\color{red}{0}00} \xrightarrow{i = 1} \mathtt{\col

Tutorials

Codeforces Round 1025 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
320162467 SP1R1D0N E May 17, 2025, 11:55 p.m. OK C++17 (GCC 7-32) TESTS 19 296 200908800
320161343 farmerboy E May 17, 2025, 11:16 p.m. OK C++17 (GCC 7-32) TESTS 19 311 2355200
320132361 Marco_-cc E May 17, 2025, 4:47 p.m. OK C++17 (GCC 7-32) TESTS 19 312 1024000
320133752 shreeyac E May 17, 2025, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 19 374 1126400
320164425 goodluck2025 E May 18, 2025, 1:03 a.m. OK C++17 (GCC 7-32) TESTS 19 436 3174400
320173110 wrp_milkdragon E May 18, 2025, 3:39 a.m. OK C++17 (GCC 7-32) TESTS 19 531 4096000
320130610 pavan_4376 E May 17, 2025, 4:44 p.m. OK C++17 (GCC 7-32) TESTS 19 624 2048000
320129859 nhphuc E May 17, 2025, 4:43 p.m. OK C++17 (GCC 7-32) TESTS 19 734 2150400
320130055 gursimarsinghmiglani E May 17, 2025, 4:43 p.m. OK C++17 (GCC 7-32) TESTS 19 780 0
320130991 goodboypratyush E May 17, 2025, 4:45 p.m. OK C++17 (GCC 7-32) TESTS 19 781 2048000
320167293 zjdl E May 18, 2025, 2:07 a.m. OK C++20 (GCC 13-64) TESTS 19 109 6246400
320164873 mika_uwu E May 18, 2025, 1:15 a.m. OK C++20 (GCC 13-64) TESTS 19 124 8089600
320140960 aPNJ777 E May 17, 2025, 6:17 p.m. OK C++20 (GCC 13-64) TESTS 19 139 102400
320142057 2ky E May 17, 2025, 6:24 p.m. OK C++20 (GCC 13-64) TESTS 19 156 4198400
320142260 TheMarioFan102 E May 17, 2025, 6:25 p.m. OK C++20 (GCC 13-64) TESTS 19 171 0
320161498 GaurangGupta E May 17, 2025, 11:22 p.m. OK C++20 (GCC 13-64) TESTS 19 171 2048000
320146623 michaelsxiang E May 17, 2025, 7:01 p.m. OK C++20 (GCC 13-64) TESTS 19 171 2150400
320139639 fishcathu E May 17, 2025, 6:12 p.m. OK C++20 (GCC 13-64) TESTS 19 187 3174400
320171684 thisislike_fan E May 18, 2025, 3:18 a.m. OK C++20 (GCC 13-64) TESTS 19 202 102400
320128092 Dogm_2 E May 17, 2025, 4:39 p.m. OK C++20 (GCC 13-64) TESTS 19 202 102400
320165808 sk1234__ E May 18, 2025, 1:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 124 2048000
320164767 Ste E May 18, 2025, 1:12 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 171 102400
320132785 oldEight E May 17, 2025, 4:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 171 2048000
320184037 Oanh_va_Khoi E May 18, 2025, 5:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 187 4096000
320132371 noob_coder1729 E May 17, 2025, 4:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 202 2150400
320183510 enslaved E May 18, 2025, 5:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 218 0
320131704 aayush01x E May 17, 2025, 4:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 218 102400
320157241 akioweh E May 17, 2025, 9:26 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 234 102400
320157173 akioweh E May 17, 2025, 9:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 234 102400
320186906 chaitanyan E May 18, 2025, 5:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 249 0
320132794 cyclop5 E May 17, 2025, 4:48 p.m. OK Go TESTS 19 405 2252800
320132664 Maruchan E May 17, 2025, 4:47 p.m. OK Java 21 TESTS 19 718 409600
320130658 SaiharshaASAP E May 17, 2025, 4:44 p.m. OK Mono C# TESTS 19 842 2764800
320129644 AllH5 E May 17, 2025, 4:42 p.m. OK PyPy 3-64 TESTS 19 577 2969600
320133924 CH23B050 E May 17, 2025, 4:49 p.m. OK PyPy 3-64 TESTS 19 1030 4812800
320163672 wabadabakalakaboo E May 18, 2025, 12:39 a.m. OK PyPy 3-64 TESTS 19 1156 28979200
320166007 sushmanth.dampur8780 E May 18, 2025, 1:40 a.m. OK PyPy 3-64 TESTS 19 1327 10956800
320146453 OldBrilliantMate E May 17, 2025, 6:59 p.m. OK PyPy 3-64 TESTS 19 1389 4915200
320156095 hxu10 E May 17, 2025, 9:03 p.m. OK PyPy 3-64 TESTS 19 1421 4608000
320130290 23l31a1291 E May 17, 2025, 4:43 p.m. OK PyPy 3-64 TESTS 19 1515 4915200
320131987 TheRealZoro E May 17, 2025, 4:46 p.m. OK PyPy 3-64 TESTS 19 1812 6144000
320128580 SnowballSH E May 17, 2025, 4:40 p.m. OK Rust 2021 TESTS 19 359 102400

remove filters

Back to search problems