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'You are given a bracket sequence s (not necessarily a regular one). A bracket sequence is a string containing only characters '( ' and ') '. A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters '1 ' and '+ ' between the original characters of the sequence. For example, bracket sequences "()()" and "(())" are regular (the resulting expressions are: "(1)+(1)" and "((1+1)+1)"), and ")(", "(" and ")" are not. Your problem is to calculate the number of regular bracket sequences of length 2n containing the given bracket sequence s as a substring (consecutive sequence of characters) modulo 10^9+7 ( 1000000007 ). The first line of the input contains one integer n ( 1 <= n <= 100 ) -- the half-length of the resulting regular bracket sequences (the resulting sequences must have length equal to 2n ). The second line of the input contains one string s ( 1 <= |s| <= 200 ) -- the string s that should be a substring in each of the resulting regular bracket sequences ( |s| is the length of s ). Print only one integer -- the number of regular bracket sequences containing the given bracket sequence s as a substring. Since this number can be huge, print it modulo 10^9+7 ( 1000000007 ). All regular bracket sequences satisfying the conditions above for the first example: All regular bracket sequences satisfying the conditions above for the second example: And there is no regular bracket sequences of length 4 containing "(((" as a substring in the third example. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
41635347 |
rr_ |
F |
Aug. 15, 2018, 10:52 p.m. |
OK |
D |
TESTS |
52 |
607 |
125849600 |
|
2600 |
41590732 |
stdio2016 |
F |
Aug. 14, 2018, 1:54 p.m. |
OK |
GNU C |
TESTS |
52 |
31 |
102400 |
|
2600 |
41115697 |
vjudge5 |
F |
Aug. 2, 2018, 8:54 a.m. |
OK |
GNU C++ |
TESTS |
52 |
31 |
614400 |
|
2600 |
41971733 |
luogu_bot4 |
F |
Aug. 22, 2018, 3:33 p.m. |
OK |
GNU C++ |
TESTS |
52 |
46 |
32563200 |
|
2600 |
41971648 |
HiedanoAkyuu |
F |
Aug. 22, 2018, 3:30 p.m. |
OK |
GNU C++ |
TESTS |
52 |
46 |
32563200 |
|
2600 |
41217464 |
xht13127 |
F |
Aug. 4, 2018, 1:44 p.m. |
OK |
GNU C++ |
TESTS |
52 |
46 |
33075200 |
|
2600 |
41612943 |
vjudge3 |
F |
Aug. 15, 2018, 7:27 a.m. |
OK |
GNU C++ |
TESTS |
52 |
46 |
34508800 |
|
2600 |
41123017 |
vjudge1 |
F |
Aug. 2, 2018, 12:54 p.m. |
OK |
GNU C++ |
TESTS |
52 |
46 |
34508800 |
|
2600 |
41380572 |
170104100115 |
F |
Aug. 9, 2018, 1:57 a.m. |
OK |
GNU C++ |
TESTS |
52 |
46 |
42700800 |
|
2600 |
41122115 |
vjudge4 |
F |
Aug. 2, 2018, 12:29 p.m. |
OK |
GNU C++ |
TESTS |
52 |
46 |
68915200 |
|
2600 |
41123174 |
vjudge5 |
F |
Aug. 2, 2018, 12:58 p.m. |
OK |
GNU C++ |
TESTS |
52 |
46 |
69222400 |
|
2600 |
41937586 |
godspeedcurry |
F |
Aug. 21, 2018, 1:37 p.m. |
OK |
GNU C++ |
TESTS |
52 |
46 |
108236800 |
|
2600 |
49621382 |
luogu_bot5 |
F |
Feb. 8, 2019, 9:36 a.m. |
OK |
GNU C++11 |
TESTS |
52 |
31 |
409600 |
|
2600 |
45202425 |
luogu_bot1 |
F |
Nov. 2, 2018, 10:51 a.m. |
OK |
GNU C++11 |
TESTS |
52 |
31 |
17817600 |
|
2600 |
43911731 |
theodor.moroianu |
F |
Oct. 6, 2018, 4:33 p.m. |
OK |
GNU C++11 |
TESTS |
52 |
31 |
19456000 |
|
2600 |
45160639 |
aszwz |
F |
Nov. 1, 2018, 8:52 a.m. |
OK |
GNU C++11 |
TESTS |
52 |
31 |
32358400 |
|
2600 |
48044923 |
OrzAM |
F |
Jan. 7, 2019, 1:04 a.m. |
OK |
GNU C++11 |
TESTS |
52 |
31 |
33075200 |
|
2600 |
41201005 |
tolight |
F |
Aug. 4, 2018, 5:11 a.m. |
OK |
GNU C++11 |
TESTS |
52 |
31 |
37171200 |
|
2600 |
41148179 |
Wavator |
F |
Aug. 3, 2018, 7:34 a.m. |
OK |
GNU C++11 |
TESTS |
52 |
31 |
66764800 |
|
2600 |
42677406 |
luogu_bot1 |
F |
Sept. 8, 2018, 2:28 p.m. |
OK |
GNU C++11 |
TESTS |
52 |
31 |
69324800 |
|
2600 |
49925056 |
Rockett |
F |
Feb. 14, 2019, 9:45 p.m. |
OK |
GNU C++11 |
TESTS |
52 |
31 |
155443200 |
|
2600 |
41123840 |
krigan |
F |
Aug. 2, 2018, 1:16 p.m. |
OK |
GNU C++11 |
TESTS |
52 |
46 |
204800 |
|
2600 |
61745145 |
pootis |
F |
Oct. 2, 2019, 11:23 p.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
307200 |
|
2600 |
41200762 |
shdut |
F |
Aug. 4, 2018, 5:01 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
716800 |
|
2600 |
46050053 |
vjudge1 |
F |
Nov. 22, 2018, 6:36 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
9113600 |
|
2600 |
41119058 |
mohamedeltair |
F |
Aug. 2, 2018, 10:53 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
32870400 |
|
2600 |
41091560 |
antguz |
F |
Aug. 1, 2018, 4:56 p.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
33587200 |
|
2600 |
41091153 |
antguz |
F |
Aug. 1, 2018, 4:44 p.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
33587200 |
|
2600 |
41316667 |
newgate |
F |
Aug. 7, 2018, 8:03 p.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
35532800 |
|
2600 |
41111470 |
dwh |
F |
Aug. 2, 2018, 7 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
31 |
74752000 |
|
2600 |
53809515 |
duxing201606 |
F |
May 6, 2019, 5:15 a.m. |
OK |
GNU C++14 |
TESTS |
52 |
46 |
716800 |
|
2600 |
41273993 |
DEMOPON |
F |
Aug. 6, 2018, 12:12 p.m. |
OK |
GNU C++14 |
TESTS |
52 |
46 |
33075200 |
|
2600 |
41095897 |
ReaLNero1 |
F |
Aug. 1, 2018, 7:31 p.m. |
OK |
GNU C++17 |
TESTS |
52 |
31 |
409600 |
|
2600 |
49998580 |
happy_ |
F |
Feb. 16, 2019, 4:15 p.m. |
OK |
GNU C++17 |
TESTS |
52 |
31 |
34508800 |
|
2600 |
41616187 |
Tunder__Sun |
F |
Aug. 15, 2018, 9:17 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
31 |
34508800 |
|
2600 |
49516462 |
dy14n3 |
F |
Feb. 6, 2019, 3:30 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
31 |
42905600 |
|
2600 |
60561341 |
hjk1030 |
F |
Sept. 14, 2019, 2:44 p.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
307200 |
|
2600 |
42292605 |
ivan100sic |
F |
Aug. 30, 2018, 10:39 p.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
819200 |
|
2600 |
58749273 |
_PortgasD.Ace_ |
F |
Aug. 13, 2019, 3:55 p.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
17100800 |
|
2600 |
58334713 |
AlexPanda |
F |
Aug. 5, 2019, 11:01 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
17715200 |
|
2600 |
65320718 |
sss |
F |
Nov. 18, 2019, 7:36 p.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
17817600 |
|
2600 |
41210444 |
cjnwq |
F |
Aug. 4, 2018, 10:16 a.m. |
OK |
GNU C++17 |
TESTS |
52 |
46 |
17920000 |
|
2600 |
41917381 |
kusomushi |
F |
Aug. 21, 2018, 12:05 a.m. |
OK |
Java 8 |
TESTS |
52 |
140 |
18636800 |
|
2600 |
52250295 |
mikkk |
F |
April 2, 2019, 10:57 p.m. |
OK |
Java 8 |
TESTS |
52 |
155 |
16998400 |
|
2600 |
45630492 |
mona_hashem |
F |
Nov. 12, 2018, 4:45 p.m. |
OK |
Java 8 |
TESTS |
52 |
155 |
38809600 |
|
2600 |
41129259 |
iamavalon |
F |
Aug. 2, 2018, 4:10 p.m. |
OK |
Java 8 |
TESTS |
52 |
248 |
16998400 |
|
2600 |
42360732 |
vadimmm |
F |
Sept. 2, 2018, 11:45 a.m. |
OK |
Java 8 |
TESTS |
52 |
748 |
142950400 |
|
2600 |
41589731 |
Mickey-snow |
F |
Aug. 14, 2018, 1:26 p.m. |
OK |
Mono C# |
TESTS |
52 |
124 |
74240000 |
|
2600 |
45674796 |
r57shell |
F |
Nov. 13, 2018, 12:35 p.m. |
OK |
MS C++ |
TESTS |
52 |
62 |
67276800 |
|
2600 |
41446426 |
Fishers |
F |
Aug. 11, 2018, 12:46 a.m. |
OK |
MS C++ |
TESTS |
52 |
78 |
66048000 |
|
2600 |
49529002 |
vjudge2 |
F |
Feb. 6, 2019, 12:57 p.m. |
OK |
MS C++ |
TESTS |
52 |
592 |
37171200 |
|
2600 |
41326382 |
Vigi1973 |
F |
Aug. 8, 2018, 5:45 a.m. |
OK |
PyPy 3 |
TESTS |
52 |
280 |
4915200 |
|
2600 |
41282587 |
Stephan |
F |
Aug. 6, 2018, 5:27 p.m. |
OK |
PyPy 3 |
TESTS |
52 |
374 |
18739200 |
|
2600 |
41282630 |
Stephan |
F |
Aug. 6, 2018, 5:29 p.m. |
OK |
PyPy 3 |
TESTS |
52 |
374 |
18841600 |
|
2600 |
61352593 |
sansen |
F |
Sept. 27, 2019, 9:01 a.m. |
OK |
Rust |
TESTS |
52 |
46 |
307200 |
|
2600 |
47249703 |
yakamoto |
F |
Dec. 19, 2018, 7:40 a.m. |
OK |
Scala |
TESTS |
52 |
639 |
60825600 |
|
2600 |
remove filters
Back to search problems