Codeforces Round 1082 (Div. 1)

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
2201 Codeforces Round 1082 (Div. 1) FINISHED False 9000 4548323 Feb. 23, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1927 ) C Rigged Bracket Sequence PROGRAMMING combinatorics dp

A regular bracket sequence is a sequence consisting of ' ( ' and ' ) ', which can be turned into a valid math expression by inserting (1) and (+) any number of times into the sequence. For example, the sequence " ()(()()) " is a regular bracket sequence, while " ())(() " or " (() " are not regular bracket sequences. You are given a regular bracket sequence (S). Let us consider shifting a subsequence (^{\text{∗}}) to the right. Formally, when a subsequence (S_{i_1} S_{i_2} \ldots S_{i_k}) is shifted to the right, the characters on the chosen indices simultaneously get reassigned as follows: (S_{i_1} \leftarrow S_{i_k}); (S_{i_2} \leftarrow S_{i_1}); (S_{i_3} \leftarrow S_{i_2}); (\ldots) (S_{i_k} \leftarrow S_{i_{k-1}}). In other words, the element of the (j)-th chosen index gets reassigned to the (((j-2) \bmod k + 1))-th chosen character. For example, when (S) is " ()(()()) ", shifting the subsequence (S_2 S_4) changes (S) to " ( ( ( ) )()) ". On the other hand, shifting (S_2 S_3 S_5) changes (S) to " ( )) ( ( ()) ". Please count how many non-empty subsequences make (S) remain regular when shifted to the right. As the answer may be huge, you are only asked to output the answer modulo (998\,244\,353). (^{\text{∗}})A sequence (a) is a subsequence of a sequence (b) if (a) can be obtained from (b) by the deletion of several (possibly, zero or all) element from arbitrary positions. Two subsequences are considered different if the sets of positions of the deleted elements are different. 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 (n) ((2 \le n \le 300\,000), (n) is even ). The second line of each test case contains a regular bracket sequence (S) of length (n) given as a

Tutorials

Codeforces Round 1082 (Div. 1, Div. 2) Complete Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
364085893 -firefly- C Feb. 23, 2026, 4:10 p.m. OK C# 13 TESTS 25 140 21299200
364109020 Treks C Feb. 23, 2026, 6:03 p.m. OK C++17 (GCC 7-32) TESTS 25 46 0
364077575 SlhShn C Feb. 23, 2026, 3:49 p.m. OK C++17 (GCC 7-32) TESTS 25 46 0
364058886 potato167 C Feb. 23, 2026, 3:12 p.m. OK C++17 (GCC 7-32) TESTS 25 46 0
364091926 ihgazi C Feb. 23, 2026, 4:27 p.m. OK C++17 (GCC 7-32) TESTS 25 46 102400
364075202 Feet_McYeet C Feb. 23, 2026, 3:43 p.m. OK C++17 (GCC 7-32) TESTS 25 46 102400
364072504 how_to_solve_D_Div2 C Feb. 23, 2026, 3:38 p.m. OK C++17 (GCC 7-32) TESTS 25 46 102400
364075846 TadijaSebez C Feb. 23, 2026, 3:45 p.m. OK C++17 (GCC 7-32) TESTS 25 46 307200
364056591 f_u_c_k_CCF C Feb. 23, 2026, 3:09 p.m. OK C++17 (GCC 7-32) TESTS 25 46 307200
364067185 Swistakk C Feb. 23, 2026, 3:27 p.m. OK C++17 (GCC 7-32) TESTS 25 46 921600
364083178 l-_-l C Feb. 23, 2026, 4:03 p.m. OK C++17 (GCC 7-32) TESTS 25 46 2457600
364103350 KiloJoule C Feb. 23, 2026, 5:03 p.m. OK C++20 (GCC 13-64) TESTS 25 31 0
364086723 tedi_2.0 C Feb. 23, 2026, 4:12 p.m. OK C++20 (GCC 13-64) TESTS 25 31 102400
364074321 Emikooh C Feb. 23, 2026, 3:41 p.m. OK C++20 (GCC 13-64) TESTS 25 31 819200
364147226 thisislike_fan C Feb. 24, 2026, 3:54 a.m. OK C++20 (GCC 13-64) TESTS 25 46 0
364115704 rejdioglava09 C Feb. 23, 2026, 7:05 p.m. OK C++20 (GCC 13-64) TESTS 25 46 0
364108468 ellipticalbilliard C Feb. 23, 2026, 5:58 p.m. OK C++20 (GCC 13-64) TESTS 25 46 0
364107919 qwe1rt1yuiop1 C Feb. 23, 2026, 5:54 p.m. OK C++20 (GCC 13-64) TESTS 25 46 0
364091557 The_Cryptic_TG C Feb. 23, 2026, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 25 46 0
364077112 BRUHHHHHHH C Feb. 23, 2026, 3:48 p.m. OK C++20 (GCC 13-64) TESTS 25 46 0
364076342 icecuber C Feb. 23, 2026, 3:46 p.m. OK C++20 (GCC 13-64) TESTS 25 46 0
364074161 300iq C Feb. 23, 2026, 3:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 31 0
364150901 khushicodes03 C Feb. 24, 2026, 5 a.m. OK C++23 (GCC 14-64, msys2) TESTS 25 31 102400
364128985 bonopo C Feb. 23, 2026, 9:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 31 102400
364100693 sidat C Feb. 23, 2026, 4:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 31 102400
364092869 awu C Feb. 23, 2026, 4:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 31 102400
364119515 kevin C Feb. 23, 2026, 7:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 31 1638400
364068156 Mitsukasa_Ayase C Feb. 23, 2026, 3:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 31 2457600
364065529 20111019Yu C Feb. 23, 2026, 3:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 31 9728000
364077445 NickMish C Feb. 23, 2026, 3:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 46 0
364070096 Tinoz C Feb. 23, 2026, 3:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 46 0
364074127 omaltsev C Feb. 23, 2026, 3:41 p.m. OK Haskell TESTS 25 281 75673600
364149335 daniel.glabai C Feb. 24, 2026, 4:33 a.m. OK Java 21 TESTS 25 250 512000
364065624 Tlatoani C Feb. 23, 2026, 3:24 p.m. OK Kotlin 2.2 TESTS 25 171 25395200
364102570 bcollet C Feb. 23, 2026, 5:01 p.m. OK PyPy 2 TESTS 25 390 7372800
364143257 realclueless C Feb. 24, 2026, 2:40 a.m. OK PyPy 3-64 TESTS 25 93 4812800
364091227 shade34 C Feb. 23, 2026, 4:25 p.m. OK PyPy 3-64 TESTS 25 109 3584000
364079927 teekaytai C Feb. 23, 2026, 3:54 p.m. OK PyPy 3-64 TESTS 25 109 4812800
364054698 p_a_r_k_j_u_n_e C Feb. 23, 2026, 3:06 p.m. OK PyPy 3-64 TESTS 25 125 7987200
364106557 ardeelia C Feb. 23, 2026, 5:45 p.m. OK PyPy 3-64 TESTS 25 140 10854400
364075598 hitman_py C Feb. 23, 2026, 3:44 p.m. OK PyPy 3-64 TESTS 25 156 10240000
364084822 alexwice C Feb. 23, 2026, 4:07 p.m. OK PyPy 3-64 TESTS 25 156 16998400
364087998 twosquares C Feb. 23, 2026, 4:16 p.m. OK PyPy 3-64 TESTS 25 171 15667200
364063723 Nikrien C Feb. 23, 2026, 3:20 p.m. OK PyPy 3-64 TESTS 25 171 17100800
364085072 detteiuu C Feb. 23, 2026, 4:07 p.m. OK PyPy 3-64 TESTS 25 187 14233600
364089516 Solalyth C Feb. 23, 2026, 4:20 p.m. OK Rust 2021 TESTS 25 62 20889600
364059836 Mon_ster C Feb. 23, 2026, 3:14 p.m. OK Rust 2024 TESTS 25 46 11776000
364059761 Darknef C Feb. 23, 2026, 3:14 p.m. OK Rust 2024 TESTS 25 78 14848000
364071089 DanielAnker C Feb. 23, 2026, 3:35 p.m. OK Rust 2024 TESTS 25 140 18739200
364101159 mertyilmaz C Feb. 23, 2026, 4:57 p.m. OK Rust 2024 TESTS 25 156 11776000

remove filters

Back to search problems