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 parentheses sequence is a string consisting of characters "(" and ")", for example "(()((". A balanced parentheses sequence is a parentheses sequence which can become a valid mathematical expression after inserting numbers and operations into it, for example "(()(()))". The balance of a parentheses sequence is defined as the number of opening parentheses "(" minus the number of closing parentheses ")". For example, the balance of the sequence "(()((" is 3. A balanced parentheses sequence can also be defined as a parentheses sequence with balance 0 such that each of its prefixes has a non-negative balance. We define the balanced shuffle operation that takes a parentheses sequence and returns a parentheses sequence as follows: first, for every character of the input sequence, we compute the balance of the prefix of the sequence before that character and write those down in a table together with the positions of the characters in the input sequence, for example: Prefix balance01212321Position12345678Character(()(())) Then, we sort the columns of this table in increasing order of prefix balance, breaking ties in decreasing order of position. In the above example, we get: Prefix balance01112223Position18427536Character()(()()) The last row of this table forms another parentheses sequence, in this case "()(()())". This sequence is called the result of applying the balanced shuffle operation to the input sequence, or in short just the balanced shuffle of the input sequence. You are given a balanced parentheses sequence. Print its balanced shuffle. The only line of input contains a string s consisting only of characters "(" and ")". This string is guaranteed to be a non-empty balanced parentheses sequence with its length not exceeding 500 ,000 . Print the parentheses sequence t -- the balanced shuffle of s . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
261495383 |
aaasss233 |
A1 |
May 18, 2024, 8:58 a.m. |
OK |
C# 10 |
TESTS |
77 |
796 |
14848000 |
|
1000 |
261947651 |
tritruong |
A1 |
May 21, 2024, 1:19 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
77 |
13824000 |
|
1000 |
261934898 |
rolex009 |
A1 |
May 20, 2024, 8:31 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
109 |
4096000 |
|
1000 |
261935933 |
rolex009 |
A1 |
May 20, 2024, 8:43 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
109 |
7168000 |
|
1000 |
262782926 |
roshnikumari212004 |
A1 |
May 26, 2024, 5:13 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
124 |
3686400 |
|
1000 |
259743976 |
2022200000190 |
A1 |
May 6, 2024, 11:55 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
125 |
4505600 |
|
1000 |
260983989 |
Leeda |
A1 |
May 14, 2024, 9:34 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
139 |
1433600 |
|
1000 |
259502885 |
Serioton_codes |
A1 |
May 4, 2024, 11:48 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
140 |
2867200 |
|
1000 |
263438613 |
sumitst05_ |
A1 |
May 31, 2024, 8:47 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
140 |
3686400 |
|
1000 |
262196168 |
Mohamed_M.M.R Eslam_Saleh EslamSamy2002 |
A1 |
May 22, 2024, 9:20 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
140 |
3686400 |
|
1000 |
263435276 |
kartik_2005 |
A1 |
May 31, 2024, 8:17 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
77 |
140 |
4505600 |
|
1000 |
261058549 |
sliverfish |
A1 |
May 15, 2024, 1:10 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
77 |
12390400 |
|
1000 |
260719307 |
suraiyamim38 |
A1 |
May 12, 2024, 10:59 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
77 |
13926400 |
|
1000 |
260716429 |
mohosinamahera23 |
A1 |
May 12, 2024, 9:45 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
77 |
13926400 |
|
1000 |
259503258 |
anupama1871980 |
A1 |
May 4, 2024, 11:50 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
77 |
13926400 |
|
1000 |
259706952 |
Pacybwoah |
A1 |
May 6, 2024, 5:34 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
109 |
3686400 |
|
1000 |
263423083 |
Tirth11 |
A1 |
May 31, 2024, 6:40 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
124 |
1331200 |
|
1000 |
260210028 |
Owais_Ahmad |
A1 |
May 10, 2024, 6:09 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
124 |
1331200 |
|
1000 |
259676193 |
Abdalrhman_Aboalela |
A1 |
May 5, 2024, 7:42 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
124 |
1331200 |
|
1000 |
260997703 |
Pratik_Pansare |
A1 |
May 15, 2024, 3:33 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
124 |
1433600 |
|
1000 |
260476240 |
Actium |
A1 |
May 11, 2024, 3:23 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
77 |
124 |
1433600 |
|
1000 |
261235379 |
najmul90 |
A1 |
May 16, 2024, 5:39 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
108 |
2355200 |
|
1000 |
260610222 |
Srbmaury |
A1 |
May 12, 2024, 5:12 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
108 |
2867200 |
|
1000 |
260199517 |
Maikyou |
A1 |
May 10, 2024, 3:54 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
108 |
8089600 |
|
1000 |
259713113 |
lanmt0 |
A1 |
May 6, 2024, 6:55 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
108 |
12492800 |
|
1000 |
262332394 |
MOSSJD |
A1 |
May 24, 2024, 4:23 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
109 |
1433600 |
|
1000 |
261266707 |
mdhlimonmia |
A1 |
May 17, 2024, 2:25 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
109 |
1433600 |
|
1000 |
260852728 |
devinqu |
A1 |
May 13, 2024, 8:07 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
109 |
1433600 |
|
1000 |
260706264 |
ashank_22 |
A1 |
May 12, 2024, 7:09 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
109 |
1433600 |
|
1000 |
260666300 |
TheSmoothOperator |
A1 |
May 12, 2024, 12:47 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
109 |
1433600 |
|
1000 |
260038335 |
ievg |
A1 |
May 8, 2024, 6:28 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
77 |
109 |
1433600 |
|
1000 |
261068656 |
bestelsuvn |
A1 |
May 15, 2024, 2:30 p.m. |
OK |
FPC |
TESTS |
77 |
125 |
4198400 |
|
1000 |
259904239 |
NenadDapic |
A1 |
May 7, 2024, 4:35 p.m. |
OK |
FPC |
TESTS |
77 |
140 |
7270400 |
|
1000 |
263542829 |
Virat_Garg |
A1 |
May 31, 2024, 7:06 p.m. |
OK |
GNU C11 |
TESTS |
77 |
187 |
6553600 |
|
1000 |
260541819 |
cccccqw |
A1 |
May 11, 2024, 1:24 p.m. |
OK |
GNU C11 |
TESTS |
77 |
202 |
4608000 |
|
1000 |
259773221 |
anirudh2005 |
A1 |
May 6, 2024, 3:39 p.m. |
OK |
GNU C11 |
TESTS |
77 |
202 |
6144000 |
|
1000 |
262703992 |
rizoantoufiq |
A1 |
May 26, 2024, 12:34 p.m. |
OK |
GNU C11 |
TESTS |
77 |
1968 |
4608000 |
|
1000 |
261692172 |
aditya22040 |
A1 |
May 19, 2024, 6:34 p.m. |
OK |
GNU C11 |
TESTS |
77 |
1999 |
4608000 |
|
1000 |
261513265 |
talha_2203035 |
A1 |
May 18, 2024, 10:24 a.m. |
OK |
GNU C11 |
TESTS |
77 |
1999 |
6553600 |
|
1000 |
260224578 |
keutoi |
A1 |
May 10, 2024, 8:33 a.m. |
OK |
Haskell |
TESTS |
77 |
1531 |
160768000 |
|
1000 |
261911506 |
zy666 |
A1 |
May 20, 2024, 4:59 p.m. |
OK |
Java 21 |
TESTS |
77 |
405 |
19763200 |
|
1000 |
259571625 |
hit_refresh |
A1 |
May 5, 2024, 12:57 a.m. |
OK |
Java 21 |
TESTS |
77 |
421 |
19251200 |
|
1000 |
261221245 |
neralkattesanket |
A1 |
May 16, 2024, 3:47 p.m. |
OK |
Java 21 |
TESTS |
77 |
468 |
19456000 |
|
1000 |
262689418 |
yashhwe |
A1 |
May 26, 2024, 10:33 a.m. |
OK |
Java 21 |
TESTS |
77 |
483 |
18227200 |
|
1000 |
260993236 |
Enderbrine16 |
A1 |
May 15, 2024, 2:09 a.m. |
OK |
Java 21 |
TESTS |
77 |
484 |
19968000 |
|
1000 |
261194421 |
tush_17 |
A1 |
May 16, 2024, 12:28 p.m. |
OK |
Java 21 |
TESTS |
77 |
499 |
22528000 |
|
1000 |
260481864 |
parz_414 |
A1 |
May 11, 2024, 4:35 a.m. |
OK |
Java 21 |
TESTS |
77 |
515 |
19046400 |
|
1000 |
261904383 |
zy666 |
A1 |
May 20, 2024, 4:43 p.m. |
OK |
Java 21 |
TESTS |
77 |
515 |
24883200 |
|
1000 |
261904134 |
zy666 |
A1 |
May 20, 2024, 4:43 p.m. |
OK |
Java 21 |
TESTS |
77 |
515 |
25088000 |
|
1000 |
262387642 |
Rakshit_07 |
A1 |
May 24, 2024, 12:54 p.m. |
OK |
Java 21 |
TESTS |
77 |
530 |
15667200 |
|
1000 |
262408565 |
karnrahul786 |
A1 |
May 24, 2024, 3:44 p.m. |
OK |
Java 8 |
TESTS |
77 |
312 |
79974400 |
|
1000 |
260775070 |
suyash.211.sn |
A1 |
May 13, 2024, 9:58 a.m. |
OK |
Java 8 |
TESTS |
77 |
343 |
9318400 |
|
1000 |
263133070 |
Nishul |
A1 |
May 29, 2024, 11:29 a.m. |
OK |
Java 8 |
TESTS |
77 |
374 |
18534400 |
|
1000 |
261905632 |
luogu_bot3 |
A1 |
May 20, 2024, 4:45 p.m. |
OK |
Java 8 |
TESTS |
77 |
421 |
6963200 |
|
1000 |
261040458 |
Ovetsar_ilish |
A1 |
May 15, 2024, 10:49 a.m. |
OK |
Java 8 |
TESTS |
77 |
421 |
16076800 |
|
1000 |
259550334 |
faresbadr316 |
A1 |
May 4, 2024, 6:59 p.m. |
OK |
Java 8 |
TESTS |
77 |
421 |
28876800 |
|
1000 |
261564257 |
interval_06 |
A1 |
May 18, 2024, 5:31 p.m. |
OK |
Java 8 |
TESTS |
77 |
452 |
17305600 |
|
1000 |
260491138 |
TommyRam |
A1 |
May 11, 2024, 6:07 a.m. |
OK |
Java 8 |
TESTS |
77 |
608 |
23449600 |
|
1000 |
262307295 |
singh_R |
A1 |
May 23, 2024, 7:40 p.m. |
OK |
Java 8 |
TESTS |
77 |
671 |
54784000 |
|
1000 |
261212462 |
NavneetKumar123 |
A1 |
May 16, 2024, 2:39 p.m. |
OK |
Java 8 |
TESTS |
77 |
828 |
57958400 |
|
1000 |
259553724 |
barvay |
A1 |
May 4, 2024, 7:36 p.m. |
OK |
Kotlin 1.9 |
TESTS |
77 |
577 |
53657600 |
|
1000 |
262805074 |
WbxOne |
A1 |
May 26, 2024, 10:02 p.m. |
OK |
Node.js |
TESTS |
77 |
406 |
85299200 |
|
1000 |
263245034 |
Ashutosh352 |
A1 |
May 30, 2024, 12:12 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
405 |
30208000 |
|
1000 |
261115298 |
biniyamnegasa |
A1 |
May 16, 2024, 1:56 a.m. |
OK |
PyPy 3 |
TESTS |
77 |
452 |
57344000 |
|
1000 |
259544774 |
wajahat |
A1 |
May 4, 2024, 6 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
1156 |
55705600 |
|
1000 |
261287604 |
Hamza_Refai |
A1 |
May 17, 2024, 6:38 a.m. |
OK |
PyPy 3 |
TESTS |
77 |
1202 |
78950400 |
|
1000 |
262987184 |
jostheboss |
A1 |
May 28, 2024, 9:18 a.m. |
OK |
PyPy 3 |
TESTS |
77 |
1233 |
81920000 |
|
1000 |
260709698 |
ladderwarrior |
A1 |
May 12, 2024, 7:53 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
1436 |
67584000 |
|
1000 |
259550995 |
debashish_1 |
A1 |
May 4, 2024, 7:06 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
1499 |
115916800 |
|
1000 |
260916135 |
prafulkatare7 |
A1 |
May 14, 2024, 11:20 a.m. |
OK |
PyPy 3 |
TESTS |
77 |
1515 |
45977600 |
|
1000 |
259547170 |
debashish_1 |
A1 |
May 4, 2024, 6:25 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
1609 |
115712000 |
|
1000 |
262621999 |
V_1995 |
A1 |
May 25, 2024, 8:10 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
1858 |
85094400 |
|
1000 |
259702796 |
lpt2000 |
A1 |
May 6, 2024, 4:17 a.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
342 |
67174400 |
|
1000 |
259691015 |
lpt2000 |
A1 |
May 6, 2024, 12:49 a.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
359 |
71884800 |
|
1000 |
262960652 |
Ne0B1ade |
A1 |
May 28, 2024, 5:22 a.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
389 |
66252800 |
|
1000 |
259751682 |
maks_stirlitz |
A1 |
May 6, 2024, 12:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
390 |
71372800 |
|
1000 |
259509171 |
Asuma_2014 |
A1 |
May 4, 2024, 12:42 p.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
405 |
84684800 |
|
1000 |
259707413 |
lpt2000 |
A1 |
May 6, 2024, 5:41 a.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
436 |
85196800 |
|
1000 |
260896391 |
silvergray |
A1 |
May 14, 2024, 8:20 a.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
483 |
57344000 |
|
1000 |
263245260 |
Ashutosh352 |
A1 |
May 30, 2024, 12:14 p.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
499 |
54169600 |
|
1000 |
262923841 |
akshayjadhavkrishnaholic |
A1 |
May 27, 2024, 6:44 p.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
499 |
99737600 |
|
1000 |
262014100 |
parsa-alz |
A1 |
May 21, 2024, 12:17 p.m. |
OK |
PyPy 3-64 |
TESTS |
77 |
561 |
114688000 |
|
1000 |
259702823 |
lpt2000 |
A1 |
May 6, 2024, 4:17 a.m. |
OK |
Python 3 |
TESTS |
77 |
374 |
64512000 |
|
1000 |
259690530 |
lpt2000 |
A1 |
May 6, 2024, 12:36 a.m. |
OK |
Python 3 |
TESTS |
77 |
406 |
68198400 |
|
1000 |
259707453 |
lpt2000 |
A1 |
May 6, 2024, 5:41 a.m. |
OK |
Python 3 |
TESTS |
77 |
421 |
64512000 |
|
1000 |
260692506 |
NhinQuenQuen |
A1 |
May 12, 2024, 4:40 p.m. |
OK |
Python 3 |
TESTS |
77 |
452 |
29184000 |
|
1000 |
259731623 |
nilucf19 |
A1 |
May 6, 2024, 10:06 a.m. |
OK |
Python 3 |
TESTS |
77 |
483 |
45260800 |
|
1000 |
259731999 |
nilucf19 |
A1 |
May 6, 2024, 10:09 a.m. |
OK |
Python 3 |
TESTS |
77 |
484 |
45260800 |
|
1000 |
262451283 |
nyaksha06 |
A1 |
May 25, 2024, 3:06 a.m. |
OK |
Python 3 |
TESTS |
77 |
515 |
78848000 |
|
1000 |
262209803 |
taduc0508 |
A1 |
May 23, 2024, 2:43 a.m. |
OK |
Python 3 |
TESTS |
77 |
530 |
78950400 |
|
1000 |
262365225 |
Just_Some_Dude |
A1 |
May 24, 2024, 9:52 a.m. |
OK |
Python 3 |
TESTS |
77 |
546 |
78950400 |
|
1000 |
262622921 |
umairgillani93 |
A1 |
May 25, 2024, 8:22 p.m. |
OK |
Python 3 |
TESTS |
77 |
546 |
79257600 |
|
1000 |
260705885 |
Chalaghoram |
A1 |
May 12, 2024, 7:04 p.m. |
OK |
Rust 2021 |
TESTS |
77 |
77 |
11878400 |
|
1000 |
260706162 |
Chalaghoram |
A1 |
May 12, 2024, 7:08 p.m. |
OK |
Rust 2021 |
TESTS |
77 |
77 |
11980800 |
|
1000 |
260705158 |
Chalaghoram |
A1 |
May 12, 2024, 6:54 p.m. |
OK |
Rust 2021 |
TESTS |
77 |
77 |
12902400 |
|
1000 |
260704883 |
Chalaghoram |
A1 |
May 12, 2024, 6:50 p.m. |
OK |
Rust 2021 |
TESTS |
77 |
78 |
13414400 |
|
1000 |
260706269 |
Chalaghoram |
A1 |
May 12, 2024, 7:09 p.m. |
OK |
Rust 2021 |
TESTS |
77 |
93 |
11878400 |
|
1000 |
260687973 |
Chalaghoram |
A1 |
May 12, 2024, 3:57 p.m. |
OK |
Rust 2021 |
TESTS |
77 |
108 |
5939200 |
|
1000 |
263035547 |
parth_7042 |
A1 |
May 28, 2024, 3:53 p.m. |
OK |
Rust 2021 |
TESTS |
77 |
109 |
7372800 |
|
1000 |
259495685 |
vstiff |
A1 |
May 4, 2024, 10:51 a.m. |
OK |
Rust 2021 |
TESTS |
77 |
109 |
7372800 |
|
1000 |
259819532 |
BetterThanNobita |
A1 |
May 7, 2024, 3:08 a.m. |
OK |
Rust 2021 |
TESTS |
77 |
109 |
10137600 |
|
1000 |
263142767 |
n0b0dy01 |
A1 |
May 29, 2024, 12:47 p.m. |
OK |
Rust 2021 |
TESTS |
77 |
124 |
18022400 |
|
1000 |
remove filters
Back to search problems