Codeforces Round 1097 (Div. 1, Based on Zhili Cup 2026)

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
2223 Codeforces Round 1097 (Div. 1, Based on Zhili Cup 2026) FINISHED False 9000 2332487 May 6, 2026, 6:05 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 74 ) F Zhily and Colorful Strings PROGRAMMING divide and conquer fft math

Since Jily's first birthday, Zhily has given him a colored string as a gift each year, and each year's gift has been different from all previous ones. This year, Jily was amazed to discover that he has received every possible distinct gift! We call a colored string that meets the following conditions valid : It consists of (m) types of characters, with exactly (n_i) characters of the (i)-th type; Each character of the (i)-th type is colored with one of (c_i) colors; The string can be reduced to an empty string by repeatedly deleting (d_i) consecutive characters of the (i)-th type that share the same color. Calculate the number of all valid colored strings, modulo (998\,244\,353). Two colored strings are considered different if they differ in at least one position (either in character type or in color). 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 a single integer (m) ((1\le m\le 2\cdot 10^5)) — the number of types. The (i)-th of the next (m) lines contains (n_i, c_i, d_i) ((1\le c_i \lt 998\,244\,353, 1\le n_i, d_i \le 10^8)) — the total count of characters of the (i)-th type, the number of colors for this type, and the required reduction length, respectively. It is guaranteed that the sum of (\left\lceil\frac{n_i}{d_i}\right\rceil) over all test cases does not exceed (2 \cdot 10^5). For each test case, output one integer in one line, representing the number of valid colored strings, modulo (998\,244\,353). For the examples, let's number all the colors by (1, 2, \ldots, \sum_{j=1}^m c_j). Where the colors (1+\sum_{j=1}^{i-1} c_j,\ldots,\sum_{j=1}^i c_j) are of the (i)-th type. Below, the color (1, 2, 3) are colored red, blue, and green, respectively. For the first test case, the valid strings are: $$$[{\color{

Tutorials

Codeforces Round 1097 (Div. 1, Div2, Based on Zhili Cup 2026) Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
373710605 superhumann F May 6, 2026, 11:45 a.m. OK C++17 (GCC 7-32) TESTS 28 1031 6451200
373716338 kaichou243 F May 6, 2026, 12:33 p.m. OK C++20 (GCC 13-64) TESTS 28 234 84172800
373689501 ItsMyGo F May 6, 2026, 8:23 a.m. OK C++20 (GCC 13-64) TESTS 28 468 116940800
373723072 main.py F May 6, 2026, 1:26 p.m. OK C++20 (GCC 13-64) TESTS 28 484 47308800
373736333 Elysion F May 6, 2026, 3:17 p.m. OK C++20 (GCC 13-64) TESTS 28 890 30310400
373714523 SATSKY_2025target_LGM F May 6, 2026, 12:18 p.m. OK C++20 (GCC 13-64) TESTS 28 1234 24780800
373695687 szsyhh F May 6, 2026, 9:10 a.m. OK C++20 (GCC 13-64) TESTS 28 1296 18329600
373725326 Acheronlt F May 6, 2026, 1:44 p.m. OK C++20 (GCC 13-64) TESTS 28 4921 42393600
373669184 XVIII F May 6, 2026, 6:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 375 5632000
373696422 s_h_i_r_u_o_y_u F May 6, 2026, 9:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 640 15564800
373695239 Yerin_Duc F May 6, 2026, 9:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 875 27648000
373693451 A10ne F May 6, 2026, 8:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 1078 22425600
373701895 scorpion F May 6, 2026, 10:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 1234 28979200
373700605 guaidaokakaxi F May 6, 2026, 10 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 1515 39424000
373770533 masy2011 F May 7, 2026, 12:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 1937 121651200
373684960 Kevin114514 F May 6, 2026, 8:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 28 2250 52224000
373782833 MBBN F May 7, 2026, 5:42 a.m. OK Java 21 TESTS 28 2093 40857600
373693546 smilences F May 6, 2026, 8:51 a.m. OK PyPy 3-64 TESTS 28 3843 94208000

remove filters

Back to search problems