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'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: A bracket sequence is called beautiful if one of the following conditions is satisfied: For example, the bracket sequences "()()", "(())", ")))(((", "))()((" are beautiful. You are given a bracket sequence s . You have to color it in such a way that: Color the given bracket sequence s into the minimum number of colors according to these constraints, or report that it is impossible. The first line contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Each test case consists of two lines. The first line contains one integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of characters in s . The second line contains s -- a string of n characters, where each character is either "(" or ")". 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 the answer as follows: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
207291265 |
1435730 |
D |
May 25, 2023, 11:30 p.m. |
OK |
GNU C11 |
TESTS |
19 |
748 |
1024000 |
|
|
207260699 |
boring73 |
D |
May 25, 2023, 4:34 p.m. |
OK |
GNU C11 |
TESTS |
19 |
779 |
1024000 |
|
|
207260237 |
maruf_bro |
D |
May 25, 2023, 4:33 p.m. |
OK |
GNU C11 |
TESTS |
19 |
779 |
1024000 |
|
|
207310095 |
mushanyu |
D |
May 26, 2023, 5:52 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
30 |
2150400 |
|
|
207263594 |
Fuad37 |
D |
May 25, 2023, 4:48 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
30 |
2150400 |
|
|
207304704 |
Kyzer1de |
D |
May 26, 2023, 4:35 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
30 |
2150400 |
|
|
207274589 |
hemantpatil10125 |
D |
May 25, 2023, 6:15 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
30 |
17715200 |
|
|
207266802 |
ShubhamJha |
D |
May 25, 2023, 5:06 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
31 |
512000 |
|
|
207272700 |
astall |
D |
May 25, 2023, 5:57 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
31 |
1024000 |
|
|
207263370 |
frznhc |
D |
May 25, 2023, 4:46 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
31 |
1024000 |
|
|
207293230 |
E-ray |
D |
May 26, 2023, 12:38 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
31 |
1024000 |
|
|
207305206 |
bekara2006 |
D |
May 26, 2023, 4:43 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
31 |
1024000 |
|
|
207305304 |
bekara2006 |
D |
May 26, 2023, 4:45 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
31 |
1024000 |
|
|
207259761 |
ckontsis |
D |
May 25, 2023, 4:33 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
30 |
1331200 |
|
|
207277171 |
cojuder01 |
D |
May 25, 2023, 6:42 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
30 |
1331200 |
|
|
207267765 |
itz_deepak23 |
D |
May 25, 2023, 5:14 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
30 |
2048000 |
|
|
207296337 |
CodeThunder |
D |
May 26, 2023, 1:56 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
30 |
2150400 |
|
|
207284471 |
stalker120 |
D |
May 25, 2023, 8:30 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
30 |
2150400 |
|
|
207259510 |
iitkgp.sinha.parth |
D |
May 25, 2023, 4:32 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
30 |
2150400 |
|
|
207295673 |
someone_lunatic_lyk_hell |
D |
May 26, 2023, 1:41 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
30 |
3788800 |
|
|
207270100 |
FreeGuy1612 |
D |
May 25, 2023, 5:34 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
31 |
512000 |
|
|
207296223 |
ajay_mnc |
D |
May 26, 2023, 1:54 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
31 |
512000 |
|
|
207300203 |
lynu_wm |
D |
May 26, 2023, 3:15 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
31 |
512000 |
|
|
207292849 |
Mohammed84Farouk |
D |
May 26, 2023, 12:25 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
1024000 |
|
|
207290537 |
MarcosK |
D |
May 25, 2023, 11:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
1331200 |
|
|
207281364 |
ujjwalcodeland |
D |
May 25, 2023, 7:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
2150400 |
|
|
207280993 |
AKSingh29 |
D |
May 25, 2023, 7:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
2150400 |
|
|
207307153 |
stop |
D |
May 26, 2023, 5:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
2969600 |
|
|
207306339 |
CCSU_Wine |
D |
May 26, 2023, 5 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
4096000 |
|
|
207289455 |
Krzychuo |
D |
May 25, 2023, 10:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
30 |
512000 |
|
|
207271914 |
anant83 |
D |
May 25, 2023, 5:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
30 |
1331200 |
|
|
207299258 |
Ceased.xp |
D |
May 26, 2023, 2:58 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
30 |
2150400 |
|
|
207281263 |
ujjwalcodeland |
D |
May 25, 2023, 7:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
30 |
2150400 |
|
|
207277583 |
hari_0oom |
D |
May 25, 2023, 6:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
512000 |
|
|
207265553 |
AbdEl-Fatah_Ahmed |
D |
May 25, 2023, 4:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
512000 |
|
|
207295958 |
bearyuc |
D |
May 26, 2023, 1:47 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
512000 |
|
|
207281174 |
Abhi8803 |
D |
May 25, 2023, 7:37 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
512000 |
|
|
207296459 |
_Yyj |
D |
May 26, 2023, 1:59 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
512000 |
|
|
207308701 |
webmaster |
D |
May 26, 2023, 5:34 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
614400 |
|
|
207293505 |
hard__ |
D |
May 26, 2023, 12:46 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
819200 |
|
|
207265669 |
I_wanna_be_Expert |
D |
May 25, 2023, 4:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
1228800 |
|
|
207295760 |
lh_118 |
D |
May 26, 2023, 1:43 a.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
1331200 |
|
|
207278303 |
TheAbysswalker |
D |
May 25, 2023, 6:56 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
15 |
1331200 |
|
|
207265656 |
koluchiy |
D |
May 25, 2023, 4:59 p.m. |
OK |
Go |
TESTS |
19 |
62 |
3072000 |
|
|
207289314 |
ETHANHUNTMI5 |
D |
May 25, 2023, 10:20 p.m. |
OK |
Java 11 |
TESTS |
19 |
187 |
0 |
|
|
207297393 |
pxhero |
D |
May 26, 2023, 2:21 a.m. |
OK |
Java 11 |
TESTS |
19 |
217 |
0 |
|
|
207286798 |
ash_79 |
D |
May 25, 2023, 9:14 p.m. |
OK |
Java 11 |
TESTS |
19 |
217 |
204800 |
|
|
207301165 |
faresbadr316 |
D |
May 26, 2023, 3:30 a.m. |
OK |
Java 11 |
TESTS |
19 |
218 |
0 |
|
|
207287781 |
sunaj |
D |
May 25, 2023, 9:37 p.m. |
OK |
Java 11 |
TESTS |
19 |
218 |
0 |
|
|
207307495 |
Utkarsh99 |
D |
May 26, 2023, 5:17 a.m. |
OK |
Java 11 |
TESTS |
19 |
233 |
512000 |
|
|
207267901 |
Panther369 |
D |
May 25, 2023, 5:15 p.m. |
OK |
Java 11 |
TESTS |
19 |
234 |
204800 |
|
|
207303432 |
ilasiawo |
D |
May 26, 2023, 4:13 a.m. |
OK |
Java 11 |
TESTS |
19 |
280 |
1536000 |
|
|
207284211 |
kasiru_69 |
D |
May 25, 2023, 8:25 p.m. |
OK |
Java 11 |
TESTS |
19 |
795 |
0 |
|
|
207266280 |
KIRA_p01 |
D |
May 25, 2023, 5:03 p.m. |
OK |
Java 11 |
TESTS |
19 |
842 |
716800 |
|
|
207279056 |
Suraj1607 |
D |
May 25, 2023, 7:06 p.m. |
OK |
Java 17 |
TESTS |
19 |
171 |
1126400 |
|
|
207265973 |
optimus1369 |
D |
May 25, 2023, 5:01 p.m. |
OK |
Java 17 |
TESTS |
19 |
248 |
1126400 |
|
|
207307796 |
q2045891621. |
D |
May 26, 2023, 5:21 a.m. |
OK |
Java 17 |
TESTS |
19 |
249 |
819200 |
|
|
207276795 |
MagentaCobra |
D |
May 25, 2023, 6:38 p.m. |
OK |
Java 17 |
TESTS |
19 |
249 |
1024000 |
|
|
207264346 |
ManasR_2003 |
D |
May 25, 2023, 4:52 p.m. |
OK |
Java 17 |
TESTS |
19 |
249 |
1433600 |
|
|
207308333 |
Mahesh_6174 |
D |
May 26, 2023, 5:29 a.m. |
OK |
Java 17 |
TESTS |
19 |
249 |
42291200 |
|
|
207260301 |
atheshwarank21cs |
D |
May 25, 2023, 4:34 p.m. |
OK |
Java 17 |
TESTS |
19 |
265 |
1024000 |
|
|
207299958 |
miminguci |
D |
May 26, 2023, 3:11 a.m. |
OK |
Java 17 |
TESTS |
19 |
265 |
1433600 |
|
|
207299045 |
bleach__ |
D |
May 26, 2023, 2:54 a.m. |
OK |
Java 17 |
TESTS |
19 |
265 |
6860800 |
|
|
207260714 |
vothikimtrang0610 |
D |
May 25, 2023, 4:34 p.m. |
OK |
Java 17 |
TESTS |
19 |
795 |
1536000 |
|
|
207298523 |
chuquwan9964 |
D |
May 26, 2023, 2:43 a.m. |
OK |
Java 8 |
TESTS |
19 |
124 |
0 |
|
|
207262722 |
NerfThis |
D |
May 25, 2023, 4:42 p.m. |
OK |
Java 8 |
TESTS |
19 |
139 |
0 |
|
|
207264561 |
Koka |
D |
May 25, 2023, 4:53 p.m. |
OK |
Java 8 |
TESTS |
19 |
140 |
0 |
|
|
207260022 |
Friendly_ShirleyCCD |
D |
May 25, 2023, 4:33 p.m. |
OK |
Java 8 |
TESTS |
19 |
155 |
0 |
|
|
207303683 |
formidablechief_27 |
D |
May 26, 2023, 4:18 a.m. |
OK |
Java 8 |
TESTS |
19 |
155 |
39219200 |
|
|
207273447 |
amit_roy |
D |
May 25, 2023, 6:04 p.m. |
OK |
Java 8 |
TESTS |
19 |
171 |
17100800 |
|
|
207268803 |
lpychemistry |
D |
May 25, 2023, 5:22 p.m. |
OK |
Java 8 |
TESTS |
19 |
187 |
0 |
|
|
207260287 |
amit_roy |
D |
May 25, 2023, 4:34 p.m. |
OK |
Java 8 |
TESTS |
19 |
202 |
17100800 |
|
|
207293717 |
duyipeng |
D |
May 26, 2023, 12:52 a.m. |
OK |
Java 8 |
TESTS |
19 |
264 |
3481600 |
|
|
207300212 |
klsane04 |
D |
May 26, 2023, 3:15 a.m. |
OK |
Java 8 |
TESTS |
19 |
265 |
0 |
|
|
207259657 |
maxv33 |
D |
May 25, 2023, 4:33 p.m. |
OK |
Kotlin 1.7 |
TESTS |
19 |
1326 |
43929600 |
|
|
207302802 |
SackSia |
D |
May 26, 2023, 4:02 a.m. |
OK |
MS C++ 2017 |
TESTS |
19 |
109 |
1740800 |
|
|
207266153 |
dharinireddy761 |
D |
May 25, 2023, 5:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
19 |
124 |
1433600 |
|
|
207302520 |
SackSia |
D |
May 26, 2023, 3:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
19 |
124 |
2252800 |
|
|
207289620 |
random__person |
D |
May 25, 2023, 10:29 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
156 |
9830400 |
|
|
207265754 |
jvatsal0709 |
D |
May 25, 2023, 4:59 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
420 |
13516800 |
|
|
207279345 |
112101017 |
D |
May 25, 2023, 7:10 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
452 |
13824000 |
|
|
207259902 |
arora.apoorv |
D |
May 25, 2023, 4:33 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
498 |
13619200 |
|
|
207271325 |
shriomks |
D |
May 25, 2023, 5:45 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
561 |
17408000 |
|
|
207284124 |
SoleProprietor |
D |
May 25, 2023, 8:24 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
93 |
8192000 |
|
|
207264526 |
HimanshuRajput |
D |
May 25, 2023, 4:53 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
156 |
11264000 |
|
|
207287498 |
Severian |
D |
May 25, 2023, 9:30 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
170 |
20787200 |
|
|
207262065 |
HimanshuRajput |
D |
May 25, 2023, 4:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
171 |
9728000 |
|
|
207299541 |
drugkeeper |
D |
May 26, 2023, 3:03 a.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
171 |
14131200 |
|
|
207262607 |
thuonguyenvan |
D |
May 25, 2023, 4:41 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
171 |
16384000 |
|
|
207291954 |
Severian |
D |
May 25, 2023, 11:55 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
171 |
20889600 |
|
|
207266297 |
riroan |
D |
May 25, 2023, 5:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
186 |
16486400 |
|
|
207286353 |
pizet |
D |
May 25, 2023, 9:05 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
186 |
22937600 |
|
|
207280657 |
AyuAnchor |
D |
May 25, 2023, 7:30 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
187 |
13414400 |
|
|
207299094 |
wzl722 |
D |
May 26, 2023, 2:55 a.m. |
OK |
Python 3 |
TESTS |
19 |
124 |
20889600 |
|
|
207259794 |
ennbie |
D |
May 25, 2023, 4:33 p.m. |
OK |
Python 3 |
TESTS |
19 |
155 |
4096000 |
|
|
207276197 |
nvllable |
D |
May 25, 2023, 6:31 p.m. |
OK |
Python 3 |
TESTS |
19 |
155 |
18432000 |
|
|
207298648 |
wzl722 |
D |
May 26, 2023, 2:46 a.m. |
OK |
Python 3 |
TESTS |
19 |
155 |
18739200 |
|
|
207263957 |
torif |
D |
May 25, 2023, 4:50 p.m. |
OK |
Python 3 |
TESTS |
19 |
171 |
18636800 |
|
|
207263961 |
abhinav10398 |
D |
May 25, 2023, 4:50 p.m. |
OK |
Python 3 |
TESTS |
19 |
171 |
21299200 |
|
|
207283391 |
BarbulevIlya |
D |
May 25, 2023, 8:11 p.m. |
OK |
Python 3 |
TESTS |
19 |
265 |
3891200 |
|
|
207260489 |
Codeforceschetans |
D |
May 25, 2023, 4:34 p.m. |
OK |
Python 3 |
TESTS |
19 |
265 |
3891200 |
|
|
207266163 |
Goldeneye534 |
D |
May 25, 2023, 5:02 p.m. |
OK |
Python 3 |
TESTS |
19 |
265 |
4403200 |
|
|
207291527 |
pennymagic156 |
D |
May 25, 2023, 11:40 p.m. |
OK |
Python 3 |
TESTS |
19 |
265 |
13004800 |
|
|
207276482 |
0npata |
D |
May 25, 2023, 6:34 p.m. |
OK |
Rust 2021 |
TESTS |
19 |
31 |
2560000 |
|
|
207285776 |
codelegend |
D |
May 25, 2023, 8:54 p.m. |
OK |
Rust 2021 |
TESTS |
19 |
31 |
3174400 |
|
|
207285151 |
codelegend |
D |
May 25, 2023, 8:42 p.m. |
OK |
Rust 2021 |
TESTS |
19 |
31 |
3174400 |
|
|
207285273 |
kost |
D |
May 25, 2023, 8:44 p.m. |
OK |
Rust 2021 |
TESTS |
19 |
109 |
11878400 |
|
|
207288518 |
dmenezes |
D |
May 25, 2023, 9:57 p.m. |
OK |
Rust 2021 |
TESTS |
19 |
186 |
1536000 |
|
|
remove filters
Back to search problems