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 string s , consisting of brackets of two types: '( ', ') ', '[ ' and '] '. A string is called a regular bracket sequence (RBS) if it 's of one of the following types: where plus is a concatenation of two strings. In one move you can choose a non-empty subsequence of the string s (not necessarily consecutive) that is an RBS, remove it from the string and concatenate the remaining parts without changing the order. What is the maximum number of moves you can perform? The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of testcases. Each of the next t lines contains a non-empty string, consisting only of characters '( ', ') ', '[ ' and '] '. The total length of the strings over all testcases doesn 't exceed 2 cdot 10^5 . For each testcase print a single integer -- the maximum number of moves you can perform on a given string s . In the first example you can just erase the whole string. In the second example you can first erase the brackets on positions 1 and 2 : "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two. In the third example you can first erase the brackets on positions 1 and 3 : "([)]". They form an RBS "()". Then "[]" is left, so you can erase it whole. In the fourth example there is no subsequence that is an RBS, so you can 't perform a move at all. In the fifth example you can erase the brackets on positions 2 and 4 : ")[(]" and get ")(" as a result. You can erase nothing from it. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
98950156 |
Shaiful_Islam_Emon |
C |
Nov. 19, 2020, 5:02 p.m. |
OK |
GNU C11 |
TESTS |
16 |
30 |
204800 |
|
|
98987480 |
Peace44 |
C |
Nov. 19, 2020, 9:38 p.m. |
OK |
GNU C11 |
TESTS |
16 |
30 |
204800 |
|
|
98978146 |
smdok |
C |
Nov. 19, 2020, 6 p.m. |
OK |
GNU C11 |
TESTS |
16 |
31 |
0 |
|
|
98998611 |
AdarshGupta1 |
C |
Nov. 20, 2020, 4:49 a.m. |
OK |
GNU C11 |
TESTS |
26 |
31 |
204800 |
|
|
98942738 |
tarunnya_1705 |
C |
Nov. 19, 2020, 4:23 p.m. |
OK |
GNU C11 |
TESTS |
16 |
31 |
204800 |
|
|
98936229 |
HarshJangrey |
C |
Nov. 19, 2020, 4:01 p.m. |
OK |
GNU C11 |
TESTS |
16 |
31 |
204800 |
|
|
99001285 |
FURY-01 |
C |
Nov. 20, 2020, 5:43 a.m. |
OK |
GNU C11 |
TESTS |
26 |
31 |
204800 |
|
|
98948350 |
i_tm_hit_iron |
C |
Nov. 19, 2020, 4:49 p.m. |
OK |
GNU C11 |
TESTS |
16 |
31 |
204800 |
|
|
98986302 |
Java |
C |
Nov. 19, 2020, 8:58 p.m. |
OK |
GNU C11 |
TESTS |
16 |
31 |
307200 |
|
|
98986017 |
Java |
C |
Nov. 19, 2020, 8:50 p.m. |
OK |
GNU C11 |
TESTS |
16 |
31 |
307200 |
|
|
98943747 |
d___d |
C |
Nov. 19, 2020, 4:27 p.m. |
OK |
GNU C++11 |
TESTS |
16 |
15 |
204800 |
|
|
98940444 |
Coder_fahim |
C |
Nov. 19, 2020, 4:15 p.m. |
OK |
GNU C++11 |
TESTS |
16 |
30 |
0 |
|
|
98949738 |
three_rockets_exploded |
C |
Nov. 19, 2020, 4:58 p.m. |
OK |
GNU C++11 |
TESTS |
16 |
30 |
512000 |
|
|
98940839 |
iHam898 |
C |
Nov. 19, 2020, 4:16 p.m. |
OK |
GNU C++11 |
TESTS |
16 |
30 |
614400 |
|
|
98977802 |
menang |
C |
Nov. 19, 2020, 5:55 p.m. |
OK |
GNU C++11 |
TESTS |
16 |
30 |
614400 |
|
|
99000747 |
sharad4730 |
C |
Nov. 20, 2020, 5:32 a.m. |
OK |
GNU C++11 |
TESTS |
26 |
30 |
614400 |
|
|
98994011 |
wow_Wonderful |
C |
Nov. 20, 2020, 2:50 a.m. |
OK |
GNU C++11 |
TESTS |
26 |
30 |
1024000 |
|
|
98990454 |
He_Ren |
C |
Nov. 20, 2020, 12:11 a.m. |
OK |
GNU C++11 |
TESTS |
26 |
31 |
0 |
|
|
98935508 |
Ice_teapoy |
C |
Nov. 19, 2020, 3:58 p.m. |
OK |
GNU C++11 |
TESTS |
16 |
31 |
0 |
|
|
98945209 |
Lucidia |
C |
Nov. 19, 2020, 4:32 p.m. |
OK |
GNU C++11 |
TESTS |
16 |
31 |
0 |
|
|
98948189 |
complex_issue |
C |
Nov. 19, 2020, 4:48 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
30 |
512000 |
|
|
98995625 |
ilham.sr |
C |
Nov. 20, 2020, 3:37 a.m. |
OK |
GNU C++14 |
TESTS |
26 |
30 |
512000 |
|
|
98984350 |
Grazy |
C |
Nov. 19, 2020, 8:04 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
30 |
614400 |
|
|
98987675 |
marcOS |
C |
Nov. 19, 2020, 9:46 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
30 |
614400 |
|
|
98936301 |
HossamHero7 |
C |
Nov. 19, 2020, 4:01 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
30 |
614400 |
|
|
98947974 |
ravi_sins |
C |
Nov. 19, 2020, 4:46 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
30 |
614400 |
|
|
98983770 |
ZergTricky |
C |
Nov. 19, 2020, 7:49 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
30 |
614400 |
|
|
98937554 |
rits1272 |
C |
Nov. 19, 2020, 4:05 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
30 |
819200 |
|
|
98998271 |
GzzhM |
C |
Nov. 20, 2020, 4:42 a.m. |
OK |
GNU C++14 |
TESTS |
26 |
31 |
204800 |
|
|
98996981 |
_HonEy |
C |
Nov. 20, 2020, 4:10 a.m. |
OK |
GNU C++14 |
TESTS |
26 |
31 |
204800 |
|
|
98977653 |
Icandoit1 |
C |
Nov. 19, 2020, 5:52 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
15 |
614400 |
|
|
98938325 |
sangam.rajeevkumar |
C |
Nov. 19, 2020, 4:07 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
30 |
204800 |
|
|
98977546 |
vik_nash |
C |
Nov. 19, 2020, 5:51 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
30 |
512000 |
|
|
98977143 |
MisterGu |
C |
Nov. 19, 2020, 5:44 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
30 |
614400 |
|
|
98962312 |
amurto |
C |
Nov. 19, 2020, 5:13 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
30 |
614400 |
|
|
98992516 |
tempatron |
C |
Nov. 20, 2020, 1:52 a.m. |
OK |
GNU C++17 |
TESTS |
26 |
30 |
614400 |
|
|
98990850 |
aditya7777gupta |
C |
Nov. 20, 2020, 12:33 a.m. |
OK |
GNU C++17 |
TESTS |
26 |
30 |
614400 |
|
|
98983782 |
MhD88 |
C |
Nov. 19, 2020, 7:49 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
30 |
614400 |
|
|
98938682 |
duplex_mp |
C |
Nov. 19, 2020, 4:09 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
30 |
819200 |
|
|
98940448 |
limaox2020 |
C |
Nov. 19, 2020, 4:15 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
31 |
0 |
|
|
98979171 |
PolarBlack |
C |
Nov. 19, 2020, 6:18 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
15 |
102400 |
|
|
98948869 |
__Achilles |
C |
Nov. 19, 2020, 4:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
30 |
512000 |
|
|
98979097 |
diyora13 |
C |
Nov. 19, 2020, 6:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
30 |
614400 |
|
|
99002253 |
ZeroooIQ |
C |
Nov. 20, 2020, 6 a.m. |
OK |
GNU C++17 (64) |
TESTS |
26 |
30 |
614400 |
|
|
98995019 |
Ashiqi_Shafi |
C |
Nov. 20, 2020, 3:19 a.m. |
OK |
GNU C++17 (64) |
TESTS |
26 |
30 |
614400 |
|
|
98990450 |
sameerg2300 |
C |
Nov. 20, 2020, 12:11 a.m. |
OK |
GNU C++17 (64) |
TESTS |
26 |
30 |
614400 |
|
|
98985183 |
HenriqueBrito |
C |
Nov. 19, 2020, 8:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
30 |
614400 |
|
|
98982715 |
__spam |
C |
Nov. 19, 2020, 7:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
30 |
614400 |
|
|
98976096 |
Misbaul |
C |
Nov. 19, 2020, 5:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
30 |
614400 |
|
|
98976090 |
301_anky |
C |
Nov. 19, 2020, 5:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
30 |
614400 |
|
|
98948121 |
lulstackcoder |
C |
Nov. 19, 2020, 4:47 p.m. |
OK |
Go |
TESTS |
16 |
608 |
204800 |
|
|
98979200 |
bittubittu |
C |
Nov. 19, 2020, 6:18 p.m. |
OK |
Java 11 |
TESTS |
16 |
171 |
0 |
|
|
98975595 |
princewillz2013 |
C |
Nov. 19, 2020, 5:21 p.m. |
OK |
Java 11 |
TESTS |
16 |
186 |
0 |
|
|
98994227 |
singhumang305 |
C |
Nov. 20, 2020, 2:56 a.m. |
OK |
Java 11 |
TESTS |
26 |
186 |
0 |
|
|
98983968 |
Snob |
C |
Nov. 19, 2020, 7:54 p.m. |
OK |
Java 11 |
TESTS |
16 |
186 |
0 |
|
|
99002016 |
an_avid_coder |
C |
Nov. 20, 2020, 5:56 a.m. |
OK |
Java 11 |
TESTS |
26 |
187 |
0 |
|
|
98937848 |
vipin__sharma |
C |
Nov. 19, 2020, 4:06 p.m. |
OK |
Java 11 |
TESTS |
16 |
187 |
0 |
|
|
98941547 |
Sejs16 |
C |
Nov. 19, 2020, 4:19 p.m. |
OK |
Java 11 |
TESTS |
16 |
187 |
0 |
|
|
98993119 |
Toinfinity |
C |
Nov. 20, 2020, 2:18 a.m. |
OK |
Java 11 |
TESTS |
26 |
202 |
0 |
|
|
98975924 |
infinity_code |
C |
Nov. 19, 2020, 5:26 p.m. |
OK |
Java 11 |
TESTS |
16 |
202 |
0 |
|
|
98941916 |
shadow_slayer |
C |
Nov. 19, 2020, 4:20 p.m. |
OK |
Java 11 |
TESTS |
16 |
202 |
0 |
|
|
98992664 |
csn3rd |
C |
Nov. 20, 2020, 1:59 a.m. |
OK |
Java 8 |
TESTS |
26 |
108 |
0 |
|
|
98941931 |
kingash101 |
C |
Nov. 19, 2020, 4:20 p.m. |
OK |
Java 8 |
TESTS |
16 |
109 |
0 |
|
|
98948783 |
arpit_c10992 |
C |
Nov. 19, 2020, 4:53 p.m. |
OK |
Java 8 |
TESTS |
16 |
109 |
0 |
|
|
98938629 |
eng_hardik |
C |
Nov. 19, 2020, 4:08 p.m. |
OK |
Java 8 |
TESTS |
16 |
109 |
0 |
|
|
98993399 |
kirubankamaraj |
C |
Nov. 20, 2020, 2:29 a.m. |
OK |
Java 8 |
TESTS |
26 |
109 |
0 |
|
|
98992438 |
Digvijaysingh0707 |
C |
Nov. 20, 2020, 1:48 a.m. |
OK |
Java 8 |
TESTS |
26 |
109 |
0 |
|
|
98992390 |
kadintang1 |
C |
Nov. 20, 2020, 1:46 a.m. |
OK |
Java 8 |
TESTS |
26 |
109 |
0 |
|
|
98987832 |
MartyByrde |
C |
Nov. 19, 2020, 9:52 p.m. |
OK |
Java 8 |
TESTS |
16 |
109 |
0 |
|
|
98981293 |
kocko |
C |
Nov. 19, 2020, 6:55 p.m. |
OK |
Java 8 |
TESTS |
16 |
109 |
0 |
|
|
98948793 |
atsvmgarg |
C |
Nov. 19, 2020, 4:53 p.m. |
OK |
Java 8 |
TESTS |
16 |
109 |
0 |
|
|
98941448 |
Ayyyoub |
C |
Nov. 19, 2020, 4:19 p.m. |
OK |
Kotlin |
TESTS |
16 |
124 |
0 |
|
|
98940391 |
MartiBook |
C |
Nov. 19, 2020, 4:15 p.m. |
OK |
Kotlin |
TESTS |
16 |
139 |
0 |
|
|
98935590 |
v4_adi |
C |
Nov. 19, 2020, 3:58 p.m. |
OK |
Kotlin |
TESTS |
16 |
140 |
0 |
|
|
98942380 |
tscha |
C |
Nov. 19, 2020, 4:22 p.m. |
OK |
Kotlin |
TESTS |
16 |
140 |
0 |
|
|
98977161 |
wbars |
C |
Nov. 19, 2020, 5:44 p.m. |
OK |
Kotlin |
TESTS |
16 |
171 |
0 |
|
|
98944195 |
Datso |
C |
Nov. 19, 2020, 4:28 p.m. |
OK |
Kotlin |
TESTS |
16 |
171 |
0 |
|
|
98986684 |
sashamc |
C |
Nov. 19, 2020, 9:10 p.m. |
OK |
Kotlin |
TESTS |
16 |
187 |
204800 |
|
|
98943995 |
Nikfilak |
C |
Nov. 19, 2020, 4:28 p.m. |
OK |
Kotlin |
TESTS |
16 |
218 |
0 |
|
|
98938140 |
ffffff666666 |
C |
Nov. 19, 2020, 4:07 p.m. |
OK |
MS C++ |
TESTS |
16 |
46 |
716800 |
|
|
98941202 |
NikolaPFC |
C |
Nov. 19, 2020, 4:18 p.m. |
OK |
MS C++ |
TESTS |
16 |
46 |
5017600 |
|
|
98944299 |
xuyuchen |
C |
Nov. 19, 2020, 4:29 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
31 |
204800 |
|
|
98940953 |
Metros |
C |
Nov. 19, 2020, 4:17 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
31 |
614400 |
|
|
98936727 |
Gl00m |
C |
Nov. 19, 2020, 4:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
31 |
614400 |
|
|
98939304 |
sherryliu987 |
C |
Nov. 19, 2020, 4:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
31 |
614400 |
|
|
98946381 |
donguri |
C |
Nov. 19, 2020, 4:34 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
31 |
614400 |
|
|
98943828 |
pragati3635 |
C |
Nov. 19, 2020, 4:27 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
31 |
716800 |
|
|
98941407 |
scottzzy |
C |
Nov. 19, 2020, 4:18 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
46 |
614400 |
|
|
99000711 |
LMd20010321 |
C |
Nov. 20, 2020, 5:32 a.m. |
OK |
MS C++ 2017 |
TESTS |
26 |
46 |
614400 |
|
|
98938910 |
Neon_Kuma |
C |
Nov. 19, 2020, 4:10 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
46 |
614400 |
|
|
98937351 |
Hyrulia |
C |
Nov. 19, 2020, 4:04 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
46 |
614400 |
|
|
98936850 |
qwdf1wd122321 |
C |
Nov. 19, 2020, 4:02 p.m. |
OK |
.NET Core C# |
TESTS |
16 |
93 |
1945600 |
|
|
98941459 |
Nidz |
C |
Nov. 19, 2020, 4:19 p.m. |
OK |
.NET Core C# |
TESTS |
16 |
108 |
3276800 |
|
|
98935802 |
thetansquared |
C |
Nov. 19, 2020, 3:59 p.m. |
OK |
.NET Core C# |
TESTS |
16 |
109 |
716800 |
|
|
98942342 |
tutai |
C |
Nov. 19, 2020, 4:22 p.m. |
OK |
Node.js |
TESTS |
16 |
124 |
8601600 |
|
|
98935568 |
CrazyDr |
C |
Nov. 19, 2020, 3:58 p.m. |
OK |
PHP |
TESTS |
16 |
61 |
0 |
|
|
98950017 |
pajenegod |
C |
Nov. 19, 2020, 5:01 p.m. |
OK |
PyPy 2 |
TESTS |
16 |
124 |
5222400 |
|
|
98939198 |
lawarganayra |
C |
Nov. 19, 2020, 4:11 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
170 |
2969600 |
|
|
98995664 |
Anuranjan_Pandey |
C |
Nov. 20, 2020, 3:38 a.m. |
OK |
PyPy 3 |
TESTS |
26 |
170 |
7168000 |
|
|
98980078 |
Stephan |
C |
Nov. 19, 2020, 6:34 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
171 |
3072000 |
|
|
98947336 |
apurva3455 |
C |
Nov. 19, 2020, 4:41 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
186 |
2560000 |
|
|
98999474 |
divyanshmandhan |
C |
Nov. 20, 2020, 5:07 a.m. |
OK |
PyPy 3 |
TESTS |
26 |
186 |
3993600 |
|
|
98986714 |
alexanderanchishkin |
C |
Nov. 19, 2020, 9:11 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
186 |
3993600 |
|
|
98937703 |
Boris_Yakunin |
C |
Nov. 19, 2020, 4:05 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
186 |
3993600 |
|
|
98990307 |
shiv_99 |
C |
Nov. 20, 2020, 12:03 a.m. |
OK |
PyPy 3 |
TESTS |
26 |
187 |
3072000 |
|
|
98976420 |
macdod |
C |
Nov. 19, 2020, 5:33 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
187 |
3788800 |
|
|
98976643 |
rushabhj |
C |
Nov. 19, 2020, 5:36 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
187 |
3891200 |
|
|
98993198 |
biltharesatyendra |
C |
Nov. 20, 2020, 2:22 a.m. |
OK |
Python 2 |
TESTS |
26 |
218 |
512000 |
|
|
98936662 |
elistark |
C |
Nov. 19, 2020, 4:02 p.m. |
OK |
Python 2 |
TESTS |
16 |
218 |
614400 |
|
|
98978910 |
r-tron18 |
C |
Nov. 19, 2020, 6:13 p.m. |
OK |
Python 3 |
TESTS |
16 |
124 |
819200 |
|
|
98979336 |
r-tron18 |
C |
Nov. 19, 2020, 6:21 p.m. |
OK |
Python 3 |
TESTS |
16 |
140 |
716800 |
|
|
98976666 |
Serjeel_Ranjan |
C |
Nov. 19, 2020, 5:36 p.m. |
OK |
Python 3 |
TESTS |
16 |
155 |
614400 |
|
|
98944848 |
i_am_trigger |
C |
Nov. 19, 2020, 4:30 p.m. |
OK |
Python 3 |
TESTS |
16 |
155 |
614400 |
|
|
98942575 |
KLWDSF_mantra |
C |
Nov. 19, 2020, 4:23 p.m. |
OK |
Python 3 |
TESTS |
16 |
155 |
1740800 |
|
|
98997290 |
sanjana5 |
C |
Nov. 20, 2020, 4:18 a.m. |
OK |
Python 3 |
TESTS |
26 |
156 |
614400 |
|
|
98981664 |
swagsy2000 |
C |
Nov. 19, 2020, 7:02 p.m. |
OK |
Python 3 |
TESTS |
16 |
156 |
614400 |
|
|
98985169 |
bug_eater |
C |
Nov. 19, 2020, 8:25 p.m. |
OK |
Python 3 |
TESTS |
16 |
156 |
716800 |
|
|
98935532 |
adrianstaniec |
C |
Nov. 19, 2020, 3:58 p.m. |
OK |
Python 3 |
TESTS |
16 |
170 |
921600 |
|
|
98937404 |
choppy |
C |
Nov. 19, 2020, 4:04 p.m. |
OK |
Python 3 |
TESTS |
16 |
171 |
614400 |
|
|
98982494 |
yosik |
C |
Nov. 19, 2020, 7:20 p.m. |
OK |
Rust |
TESTS |
16 |
31 |
819200 |
|
|
98977287 |
dp0 |
C |
Nov. 19, 2020, 5:46 p.m. |
OK |
Rust |
TESTS |
16 |
46 |
512000 |
|
|
98948001 |
nikitajegorovs |
C |
Nov. 19, 2020, 4:46 p.m. |
OK |
Scala |
TESTS |
16 |
607 |
8704000 |
|
|
remove filters
Back to search problems