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 |
1571
|
Kotlin Heroes: Episode 8 |
FINISHED |
False |
9900 |
103649063 |
Oct. 7, 2021, 2:35 p.m. |
Problems
B'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: You are given two strings s and a , the string s has length n , the string a has length n - 3 . The string s is a bracket sequence (i. xe2 x80 x89e. each element of this string is either an opening bracket character or a closing bracket character). The string a is a binary string (i. xe2 x80 x89e. each element of this string is either 1 or 0). The string a imposes some constraints on the string s : for every i such that a_i is 1, the string s_i s_{i+1} s_{i+2} s_{i+3} should be a regular bracket sequence. Characters of a equal to 0 don 't impose any constraints. Initially, the string s may or may not meet these constraints. You can perform the following operation any number of times: replace some character of s with its inverse (i. xe2 x80 x89e. you can replace an opening bracket with a closing bracket, or vice versa). Determine if it is possible to change some characters in s so that it meets all of the constraints, and if it is possible, calculate the minimum number of characters to be changed. The first line contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Each test case consists of three lines. The first line contains one integer n ( 4 <= n <= 2 cdot 10^5 ). The second line contains the string s , consisting of exactly n characters; each character of s is either '( ' or ') '. The third line contains the string a , consisting of exactly n - 3 characters; each character of a is either '1 ' or '0 '. Additional constraint on the input: the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print one integer: the minimum number of characters that need to be changed in '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
131083582 |
sokian |
E |
Oct. 7, 2021, 3:30 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
109 |
20684800 |
|
|
131089173 |
SlowLegendaryNoobMaster |
E |
Oct. 7, 2021, 4:38 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
109 |
20787200 |
|
|
131093242 |
nor |
E |
Oct. 7, 2021, 5:44 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
124 |
20992000 |
|
|
131088544 |
Arrias |
E |
Oct. 7, 2021, 4:22 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
124 |
20992000 |
|
|
131084974 |
itohdak |
E |
Oct. 7, 2021, 3:42 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
124 |
21094400 |
|
|
131083679 |
azukun |
E |
Oct. 7, 2021, 3:30 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
139 |
20582400 |
|
|
131083590 |
tabr |
E |
Oct. 7, 2021, 3:30 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
139 |
22732800 |
|
|
131081213 |
eatmore |
E |
Oct. 7, 2021, 3:10 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
140 |
20582400 |
|
|
131079799 |
xiaowuc1 |
E |
Oct. 7, 2021, 2:58 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
140 |
20582400 |
|
|
131089144 |
ynq1242 |
E |
Oct. 7, 2021, 4:37 p.m. |
OK |
Kotlin 1.4 |
TESTS |
11 |
140 |
20787200 |
|
|
131084851 |
gleb.astashkin |
E |
Oct. 7, 2021, 3:41 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
202 |
24780800 |
|
|
131086187 |
bobib |
E |
Oct. 7, 2021, 3:54 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
202 |
25497600 |
|
|
131084008 |
alexey.enkov |
E |
Oct. 7, 2021, 3:34 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
202 |
25702400 |
|
|
131081543 |
lightseba |
E |
Oct. 7, 2021, 3:13 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
217 |
25395200 |
|
|
131081707 |
arvindf232 |
E |
Oct. 7, 2021, 3:14 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
218 |
26624000 |
|
|
131082133 |
Egor |
E |
Oct. 7, 2021, 3:17 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
218 |
26726400 |
|
|
131082625 |
uwi |
E |
Oct. 7, 2021, 3:21 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
233 |
25497600 |
|
|
131085515 |
Musin |
E |
Oct. 7, 2021, 3:47 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
233 |
26828800 |
|
|
131083722 |
Roll_Num_56 |
E |
Oct. 7, 2021, 3:31 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
248 |
25088000 |
|
|
131085134 |
antonis.white |
E |
Oct. 7, 2021, 3:44 p.m. |
OK |
Kotlin 1.5 |
TESTS |
11 |
249 |
24883200 |
|
|
remove filters
Back to search problems