Codeforces Round 1079 (Div. 1)

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
2196 Codeforces Round 1079 (Div. 1) FINISHED False 10800 5585123 Feb. 11, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 976 ) D Double Bracket Sequence PROGRAMMING data structures dp greedy sortings

Given a string (s) of even length, consisting of the characters " ( ", " ) ", " " and " ", which are brackets of two types (round and square). We call a string (t) beautiful if it satisfies two conditions simultaneously: The subsequence of all round brackets forms a correct bracket sequence(^{\text{∗}}); The subsequence of all square brackets forms a correct bracket sequence. For example, the string " ([)[]]() " is beautiful , as the subsequence of all round brackets in it " ()() " forms a correct bracket sequence and the subsequence of all square brackets in it " [][[]] " forms a correct bracket sequence. You would like to turn (s) into any beautiful string; for this, you can change the characters: in one operation, you can choose a position (i), such that (1 \le i \le n) and change the character (s_{i}) to any round or square bracket. What is the minimum number of operations required to transform (s) into any beautiful string? (^{\text{∗}})A bracket sequence is called correct if by inserting the symbols " + " and " 1 " into it, one can obtain a valid mathematical expression. For example, the sequences " (())() ", " [] " and " (()(())) " are correct, while " )( ", " [[] " and " (()))( " are not. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains one integer (n) ((2 \le n \le 2 \cdot 10^{5})) — the length of the string (s). It is guaranteed that (n) is even. The second line of each test case contains a string (s) of length (n), consisting only of the characters " ( ", " ) ", " " and " ". It is guaranteed that the sum of (n) across all test cases does not exceed (2 \cdot 10^5) For each test case, output a single integer — the answer to the problem. In the first test case, from (s) you can obtain " [] " by changing the seco

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
362511559 Salamnka D Feb. 11, 2026, 4:59 p.m. OK C++17 (GCC 7-32) TESTS 26 46 0
362570629 IamHereForFun D Feb. 12, 2026, 4:14 a.m. OK C++17 (GCC 7-32) TESTS 26 46 102400
362521791 Door_Dark_We D Feb. 11, 2026, 5:21 p.m. OK C++17 (GCC 7-32) TESTS 26 46 307200
362478904 More D Feb. 11, 2026, 3:57 p.m. OK C++17 (GCC 7-32) TESTS 26 46 307200
362511787 sabino1 D Feb. 11, 2026, 5 p.m. OK C++17 (GCC 7-32) TESTS 26 46 1536000
362563831 Feynman5210 D Feb. 12, 2026, 2:27 a.m. OK C++17 (GCC 7-32) TESTS 26 46 1638400
362496753 f_u_c_k_CCF D Feb. 11, 2026, 4:29 p.m. OK C++17 (GCC 7-32) TESTS 26 46 5120000
362522036 pandaforever D Feb. 11, 2026, 5:22 p.m. OK C++17 (GCC 7-32) TESTS 26 46 5324800
362523657 under1oop D Feb. 11, 2026, 5:25 p.m. OK C++17 (GCC 7-32) TESTS 26 46 12083200
362514103 1225Xia D Feb. 11, 2026, 5:05 p.m. OK C++17 (GCC 7-32) TESTS 26 46 17100800
362544134 phoenix0423 D Feb. 11, 2026, 7:54 p.m. OK C++20 (GCC 13-64) TESTS 26 31 102400
362573298 2730883287 D Feb. 12, 2026, 4:52 a.m. OK C++20 (GCC 13-64) TESTS 26 46 102400
362560262 Kherkani_36 D Feb. 12, 2026, 1:01 a.m. OK C++20 (GCC 13-64) TESTS 26 46 102400
362558144 Tmitmi D Feb. 12, 2026, midnight OK C++20 (GCC 13-64) TESTS 26 46 102400
362557239 i-love-ayase-momo D Feb. 11, 2026, 11:36 p.m. OK C++20 (GCC 13-64) TESTS 26 46 102400
362556362 Bossusuprem D Feb. 11, 2026, 11:10 p.m. OK C++20 (GCC 13-64) TESTS 26 46 102400
362555243 FANAT_MORGENSHTERNA D Feb. 11, 2026, 10:40 p.m. OK C++20 (GCC 13-64) TESTS 26 46 102400
362551970 Justinshao D Feb. 11, 2026, 9:36 p.m. OK C++20 (GCC 13-64) TESTS 26 46 102400
362551628 Ivan_len D Feb. 11, 2026, 9:31 p.m. OK C++20 (GCC 13-64) TESTS 26 46 102400
362546925 H-R-2004 D Feb. 11, 2026, 8:26 p.m. OK C++20 (GCC 13-64) TESTS 26 46 102400
362500214 gubidubi D Feb. 11, 2026, 4:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 31 0
362575564 filliones D Feb. 12, 2026, 5:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 26 46 0
362565687 enslaved D Feb. 12, 2026, 3:04 a.m. OK C++23 (GCC 14-64, msys2) TESTS 26 46 0
362551380 Mhn_Neek D Feb. 11, 2026, 9:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 46 0
362520751 man_of_learning D Feb. 11, 2026, 5:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 46 0
362515049 VanshRA D Feb. 11, 2026, 5:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 46 0
362507201 konghaojie D Feb. 11, 2026, 4:50 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 46 0
362505173 CasseShimada D Feb. 11, 2026, 4:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 46 0
362467450 MartinRT D Feb. 11, 2026, 3:39 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 46 0
362572768 zjwwjhy D Feb. 12, 2026, 4:45 a.m. OK C++23 (GCC 14-64, msys2) TESTS 26 46 102400
362485752 SumitXorY D Feb. 11, 2026, 4:09 p.m. OK Java 21 TESTS 26 281 5427200
362567389 DP_Once D Feb. 12, 2026, 3:33 a.m. OK Java 8 TESTS 26 125 0
362468862 Tlatoani D Feb. 11, 2026, 3:41 p.m. OK Kotlin 2.2 TESTS 26 203 27443200
362483453 dyppp D Feb. 11, 2026, 4:04 p.m. OK PyPy 3-64 TESTS 26 187 18944000
362521202 harurun4635 D Feb. 11, 2026, 5:20 p.m. OK PyPy 3-64 TESTS 26 187 21708800
362513891 Ergodic137 D Feb. 11, 2026, 5:04 p.m. OK PyPy 3-64 TESTS 26 218 13312000
362515029 literalchild D Feb. 11, 2026, 5:07 p.m. OK PyPy 3-64 TESTS 26 390 9728000
362514483 SadMachine D Feb. 11, 2026, 5:06 p.m. OK PyPy 3-64 TESTS 26 531 45158400
362522891 __baozii__ D Feb. 11, 2026, 5:24 p.m. OK PyPy 3-64 TESTS 26 609 10342400
362476336 Mon_ster D Feb. 11, 2026, 3:53 p.m. OK Rust 2024 TESTS 26 31 11776000
362521925 Sugar_fan D Feb. 11, 2026, 5:22 p.m. OK Rust 2024 TESTS 26 62 15564800
362500061 Egor D Feb. 11, 2026, 4:35 p.m. OK Rust 2024 TESTS 26 78 11776000

remove filters

Back to search problems