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 |
1488
|
Kotlin Heroes: Episode 6 |
FINISHED |
False |
9000 |
121965863 |
March 9, 2021, 2:35 p.m. |
Problems
B'A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence (or, shortly, an RBS) 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: You are given a string s , which is an RBS. You can apply any number of operations to this string. Each operation can have one of the following types: The operation 2 can be applied at most k times. Calculate the maximum number of operations you can apply until s becomes empty. The first line contains one integer t ( 1 <= t <= 10^5 ) -- the number of test cases. Each test case is described by two lines. The first line contains two integers n and k ( 2 <= n <= 2 cdot 10^5 ; 1 <= k <= n ; n is even) -- the length of s and the maximum number of operations of type 2 you can apply. The second line contains a string s of n characters '( ' and ') '. This string is an RBS. The sum of n over all test cases doesn 't exceed 2 cdot 10^5 . For each test case, print one integer -- the maximum number of operations you can apply. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
109495804 |
songsinger |
B |
March 9, 2021, 3:05 p.m. |
OK |
Kotlin |
TESTS |
20 |
124 |
0 |
|
|
109493181 |
Egor |
B |
March 9, 2021, 2:41 p.m. |
OK |
Kotlin |
TESTS |
20 |
124 |
0 |
|
|
109496670 |
okwedook |
B |
March 9, 2021, 3:14 p.m. |
OK |
Kotlin |
TESTS |
20 |
139 |
0 |
|
|
109493445 |
Spheniscine |
B |
March 9, 2021, 2:44 p.m. |
OK |
Kotlin |
TESTS |
20 |
139 |
0 |
|
|
109497135 |
arvindf232 |
B |
March 9, 2021, 3:18 p.m. |
OK |
Kotlin |
TESTS |
20 |
140 |
0 |
|
|
109494670 |
rotavirus |
B |
March 9, 2021, 2:55 p.m. |
OK |
Kotlin |
TESTS |
20 |
140 |
0 |
|
|
109494124 |
itohdak |
B |
March 9, 2021, 2:50 p.m. |
OK |
Kotlin |
TESTS |
20 |
140 |
0 |
|
|
109493987 |
Ra16bit |
B |
March 9, 2021, 2:48 p.m. |
OK |
Kotlin |
TESTS |
20 |
140 |
0 |
|
|
109493492 |
eatmore |
B |
March 9, 2021, 2:44 p.m. |
OK |
Kotlin |
TESTS |
20 |
140 |
0 |
|
|
109493363 |
koboshi |
B |
March 9, 2021, 2:43 p.m. |
OK |
Kotlin |
TESTS |
20 |
140 |
0 |
|
|
remove filters
Back to search problems