Pinely Round 5 (Div. 1 + 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
2161 Pinely Round 5 (Div. 1 + Div. 2) FINISHED False 10800 14563523 Oct. 30, 2025, 4:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 774 ) E Left is Always Right PROGRAMMING combinatorics math

Consider a binary string of length (n) and an odd number (k). We will call the binary string good if for each substring of length (k), the leftmost character of the substring occurs more than the other. For example, if (k = 3), 000101 is a good string, because for all substrings of length 3 ( 000 , 001 , 010 , and 101 ) the first character of the substring occurs more than the other character. On the other hand, 1011 is not good, because the property is false for 011 . Given a pattern of length (n) consisting of characters 0 , 1 and ? , find the number of ways to replace question marks with 0 or 1 , such that the resulting binary string is good. Since the answer may be large, find it modulo (998\,244\,353). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^3)). The description of the test cases follows. The first line of each test case contains two integers (n) and (k) ((3 \le k \le n \le 10^5), (k) is odd). The second line contains (n) characters 0 , 1 or ? — the pattern. It is guaranteed that the sum of (n) over all test cases does not exceed (10^5). For each test case, print the number of ways to replace ? with 0 or 1 such that the resulting string is good, modulo (998\,244\,353). In the first example, three valid ways to make the pattern good are 00000 , 00001 , and 00101 . In the second example, the only invalid way (out of 16 total ways) is 1001001 .

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
346723395 Ste E Oct. 30, 2025, 6:51 p.m. OK C++17 (GCC 7-32) TESTS 64 62 1638400
346753094 viobow E Oct. 31, 2025, 1:22 a.m. OK C++17 (GCC 7-32) TESTS 64 77 102400
346728769 antonis.white E Oct. 30, 2025, 7:13 p.m. OK C++17 (GCC 7-32) TESTS 64 77 409600
346758322 Tianyi_lemon E Oct. 31, 2025, 2:59 a.m. OK C++17 (GCC 7-32) TESTS 64 77 819200
346739685 JOliva E Oct. 30, 2025, 8:39 p.m. OK C++17 (GCC 7-32) TESTS 64 77 1638400
346735842 Kaitokid E Oct. 30, 2025, 7:59 p.m. OK C++17 (GCC 7-32) TESTS 64 77 2457600
346723666 JaeminPark E Oct. 30, 2025, 6:52 p.m. OK C++17 (GCC 7-32) TESTS 64 77 2969600
346734286 Kieray E Oct. 30, 2025, 7:34 p.m. OK C++17 (GCC 7-32) TESTS 64 77 5632000
346728788 fishy15 E Oct. 30, 2025, 7:13 p.m. OK C++17 (GCC 7-32) TESTS 64 78 1638400
346717953 W1nn1e0xb E Oct. 30, 2025, 6:31 p.m. OK C++17 (GCC 7-32) TESTS 64 78 4096000
346740266 testerAbstract E Oct. 30, 2025, 8:47 p.m. OK C++20 (GCC 13-64) TESTS 64 62 0
346769063 nwblanton E Oct. 31, 2025, 5:12 a.m. OK C++20 (GCC 13-64) TESTS 64 62 614400
346752777 antguz E Oct. 31, 2025, 1:15 a.m. OK C++20 (GCC 13-64) TESTS 64 62 1843200
346762339 Zachary_Gao E Oct. 31, 2025, 3:53 a.m. OK C++20 (GCC 13-64) TESTS 64 62 2662400
346736875 EBeason E Oct. 30, 2025, 8:08 p.m. OK C++20 (GCC 13-64) TESTS 64 62 3686400
346745484 RaresPoinaru E Oct. 30, 2025, 10:10 p.m. OK C++20 (GCC 13-64) TESTS 64 62 4812800
346736968 shinigami11 E Oct. 30, 2025, 8:09 p.m. OK C++20 (GCC 13-64) TESTS 64 62 5734400
346736207 shinigami11 E Oct. 30, 2025, 8:02 p.m. OK C++20 (GCC 13-64) TESTS 64 62 9011200
346736695 romarkovets E Oct. 30, 2025, 8:07 p.m. OK C++20 (GCC 13-64) TESTS 64 62 16076800
346716245 Eldar_H1 E Oct. 30, 2025, 6:25 p.m. OK C++20 (GCC 13-64) TESTS 64 77 0
346741409 SATSKY_2025target_LGM E Oct. 30, 2025, 9:01 p.m. OK C++23 (GCC 14-64, msys2) TESTS 64 61 921600
346774139 krit3379 E Oct. 31, 2025, 6:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 64 62 102400
346744867 enslaved E Oct. 30, 2025, 9:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 64 62 102400
346737121 ibrm E Oct. 30, 2025, 8:11 p.m. OK C++23 (GCC 14-64, msys2) TESTS 64 62 2150400
346770423 nhonyc E Oct. 31, 2025, 5:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 64 62 2457600
346742543 SATSKY_2025target_LGM E Oct. 30, 2025, 9:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 64 62 3276800
346752584 _WD_ E Oct. 31, 2025, 1:10 a.m. OK C++23 (GCC 14-64, msys2) TESTS 64 62 5632000
346758450 _cly_ E Oct. 31, 2025, 3:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 64 62 5734400
346754069 YuukiS E Oct. 31, 2025, 1:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 64 62 8089600
346748420 ABitVeryScaredOfWomen E Oct. 30, 2025, 11:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 64 62 20070400
346746704 gua069 E Oct. 30, 2025, 10:37 p.m. OK Java 8 TESTS 64 156 0
346716344 tassei903 E Oct. 30, 2025, 6:25 p.m. OK PyPy 3-64 TESTS 64 218 9728000
346725947 dyppp E Oct. 30, 2025, 7:01 p.m. OK PyPy 3-64 TESTS 64 218 18227200
346721095 CDastrup E Oct. 30, 2025, 6:42 p.m. OK PyPy 3-64 TESTS 64 280 12595200
346714075 golomb E Oct. 30, 2025, 6:18 p.m. OK PyPy 3-64 TESTS 64 296 13721600
346729349 OpKos E Oct. 30, 2025, 7:15 p.m. OK PyPy 3-64 TESTS 64 484 12288000
346724157 Egor E Oct. 30, 2025, 6:53 p.m. OK Rust 2024 TESTS 64 93 102400

remove filters

Back to search problems