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.
Problems
B'This is the easy version of this problem. The only difference is the limit of n - the length of the input string. In this version, 1 <= q n <= q 2000 . The hard version of this challenge is not offered in the round for the second division. Let 's define a correct bracket sequence and its depth as follow: For a (not necessarily correct) bracket sequence s , we define its depth as the maximum depth of any correct bracket sequence induced by removing some characters from s (possibly zero). For example: the bracket sequence s = "())(())" has depth 2 , because by removing the third character we obtain a correct bracket sequence "()(())" with depth 2 . Given a string a consists of only characters '( ', ') ' and '? '. Consider all (not necessarily correct) bracket sequences obtained by replacing all characters '? ' in a by either '( ' or ') '. Calculate the sum of all the depths of all these bracket sequences. As this number can be large, find it modulo 998244353 . Hacks in this problem in the first division can be done only if easy and hard versions of this problem was solved. The only line contains a non-empty string consist of only '( ', ') ' and '? '. The length of the string is at most 2000 . Print the answer modulo 998244353 in a single line. In the first test case, we can obtain 4 bracket sequences by replacing all characters '? ' with either '( ' or ') ': So, the answer is 1 = 0 + 0 + 0 + 1 . In the second test case, we can obtain 4 bracket sequences by replacing all characters '? ' with either '( ' or ') ': So, the answer is 9 = 2 + 2 + 3 + 2 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
66379618 |
AutumnKite |
D1 |
Dec. 6, 2019, 4:57 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
8806400 |
|
2600 |
66658129 |
dqa2020 |
D1 |
Dec. 12, 2019, 2:04 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
16896000 |
|
2600 |
66380967 |
lzoilxy |
D1 |
Dec. 6, 2019, 5:35 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
16998400 |
|
2600 |
66385121 |
feeder |
D1 |
Dec. 6, 2019, 7:13 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
24064000 |
|
2600 |
66375455 |
yasugongshang |
D1 |
Dec. 6, 2019, 2:24 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
25088000 |
|
2600 |
66617581 |
Dilute |
D1 |
Dec. 11, 2019, 5:12 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
29081600 |
|
2600 |
66784693 |
Shrich |
D1 |
Dec. 13, 2019, 1:15 p.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
45056000 |
|
2600 |
67652583 |
TrivialMan |
D1 |
Dec. 26, 2019, 12:42 p.m. |
OK |
GNU C++11 |
TESTS |
62 |
46 |
16179200 |
|
2600 |
67652492 |
TrivialMan |
D1 |
Dec. 26, 2019, 12:40 p.m. |
OK |
GNU C++11 |
TESTS |
62 |
46 |
16179200 |
|
2600 |
66373927 |
msuwakow |
D1 |
Dec. 6, 2019, 1:09 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
46 |
35430400 |
|
2600 |
66414517 |
hellomath |
D1 |
Dec. 6, 2019, 4:32 p.m. |
OK |
GNU C++14 |
TESTS |
62 |
30 |
21094400 |
|
2600 |
66393413 |
obadayousef |
D1 |
Dec. 6, 2019, 9:54 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
0 |
|
2600 |
66376114 |
jiangly |
D1 |
Dec. 6, 2019, 2:50 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
0 |
|
2600 |
66618553 |
19992147 |
D1 |
Dec. 11, 2019, 5:49 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
102400 |
|
2600 |
66379043 |
AuqaKyz |
D1 |
Dec. 6, 2019, 4:40 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
1126400 |
|
2600 |
66370606 |
Motarack |
D1 |
Dec. 5, 2019, 9:50 p.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
13004800 |
|
2600 |
66434499 |
little_misfortune |
D1 |
Dec. 7, 2019, 5:28 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
16998400 |
|
2600 |
66613781 |
daniel14311531 |
D1 |
Dec. 11, 2019, 1:21 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
25088000 |
|
2600 |
66829193 |
gs12117 |
D1 |
Dec. 14, 2019, 10:01 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
33075200 |
|
2600 |
66784517 |
Shrich |
D1 |
Dec. 13, 2019, 1:11 p.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
45056000 |
|
2600 |
69504951 |
ks3rr |
D1 |
Jan. 25, 2020, 8:10 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
0 |
|
2600 |
67847094 |
Shahriar_88 |
D1 |
Dec. 28, 2019, 10:26 p.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
0 |
|
2600 |
66404745 |
paulica |
D1 |
Dec. 6, 2019, 1:21 p.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
0 |
|
2600 |
66393322 |
Nakagawa.Kanon |
D1 |
Dec. 6, 2019, 9:52 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
0 |
|
2600 |
66605019 |
Marckess |
D1 |
Dec. 10, 2019, 6:06 p.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
102400 |
|
2600 |
67015689 |
betrue12 |
D1 |
Dec. 16, 2019, 11:25 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
409600 |
|
2600 |
69702991 |
Hugin |
D1 |
Jan. 29, 2020, 2:25 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
7987200 |
|
2600 |
66580772 |
JHSN |
D1 |
Dec. 10, 2019, 9:16 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
25088000 |
|
2600 |
66572269 |
K0u1e |
D1 |
Dec. 10, 2019, 5:27 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
33075200 |
|
2600 |
66390890 |
HyscereXD |
D1 |
Dec. 6, 2019, 9:05 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
31 |
33075200 |
|
2600 |
66615481 |
uwi |
D1 |
Dec. 11, 2019, 3:26 a.m. |
OK |
Java 8 |
TESTS |
62 |
171 |
2252800 |
|
2600 |
66614799 |
uwi |
D1 |
Dec. 11, 2019, 2:41 a.m. |
OK |
Java 8 |
TESTS |
62 |
218 |
38195200 |
|
2600 |
66543817 |
Nutella3000 |
D1 |
Dec. 9, 2019, 12:31 p.m. |
OK |
Java 8 |
TESTS |
62 |
296 |
77312000 |
|
2600 |
66374067 |
dalt |
D1 |
Dec. 6, 2019, 1:17 a.m. |
OK |
Java 8 |
TESTS |
62 |
327 |
41062400 |
|
2600 |
66427105 |
tarattata1 |
D1 |
Dec. 6, 2019, 10:39 p.m. |
OK |
MS C++ |
TESTS |
62 |
187 |
102400 |
|
2600 |
67457619 |
Taiber009 |
D1 |
Dec. 23, 2019, 7:41 a.m. |
OK |
MS C++ 2017 |
TESTS |
62 |
31 |
307200 |
|
2600 |
66391896 |
altunyanv |
D1 |
Dec. 6, 2019, 9:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
62 |
78 |
39014400 |
|
2600 |
66466510 |
efyjef |
D1 |
Dec. 7, 2019, 4:42 p.m. |
OK |
MS C++ 2017 |
TESTS |
62 |
140 |
32768000 |
|
2600 |
66486682 |
Ivan11 |
D1 |
Dec. 8, 2019, 6:44 a.m. |
OK |
MS C++ 2017 |
TESTS |
62 |
452 |
32460800 |
|
2600 |
67214071 |
gearjack |
D1 |
Dec. 19, 2019, 2:43 p.m. |
OK |
Rust |
TESTS |
62 |
342 |
96563200 |
|
2600 |
66527175 |
sansen |
D1 |
Dec. 9, 2019, 5:39 a.m. |
OK |
Rust |
TESTS |
62 |
374 |
34099200 |
|
2600 |
remove filters
Back to search problems