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 |
---|---|---|---|---|---|---|
1503 | Codeforces Round 712 (Div. 1) | FINISHED | False | 8100 | 114362699 | April 3, 2021, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 13488 ) | A | Balance the Bits | PROGRAMMING | constructive algorithms greedy | 1600 |
B'A sequence of brackets is called balanced if one can turn it into a valid math expression by adding characters '+ ' and '1 '. For example, sequences '(())() ', '() ', and '(()(())) ' are balanced, while ')( ', '(() ', and '(()))( ' are not. You are given a binary string s of length n . Construct two balanced bracket sequences a and b of length n such that for all 1 <= i <= n : If it is impossible, you should report about it. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 , n is even). The next line contains a string s of length n , consisting of characters 0 and 1. The sum of n across all test cases does not exceed 2 cdot 10^5 . If such two balanced bracked sequences exist, output "YES" on the first line, otherwise output "NO". You can print each letter in any case (upper or lower). If the answer is "YES", output the balanced bracket sequences a and b satisfying the conditions on the next two lines. If there are multiple solutions, you may print any. In the first test case, a= "()()()" and b= "((()))". The characters are equal in positions 1 , 3 , 4 , and 6 , which are the exact same positions where s_i=1 . In the second test case, a= "()()((()))" and b= "(())()()()". The characters are equal in positions 1 , 4 , 5 , 7 , 8 , 10 , which are the exact same positions where s_i=1 . In the third test case, there is no solution. '... |
T |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
111873234 | hos.lyric | A | April 3, 2021, 2:41 p.m. | OK | D | TESTS | 25 | 31 | 4198400 | 1600 | |
111882737 | command_block | A | April 3, 2021, 2:53 p.m. | OK | GNU C++11 | TESTS | 25 | 30 | 409600 | 1600 | |
111887644 | QwQcOrZ | A | April 3, 2021, 2:59 p.m. | OK | GNU C++11 | TESTS | 25 | 30 | 409600 | 1600 | |
111892938 | __23333 | A | April 3, 2021, 3:07 p.m. | OK | GNU C++11 | TESTS | 25 | 30 | 614400 | 1600 | |
111883773 | yang12138 | A | April 3, 2021, 2:54 p.m. | OK | GNU C++11 | TESTS | 25 | 30 | 614400 | 1600 | |
111910348 | srijon51 | A | April 3, 2021, 3:39 p.m. | OK | GNU C++11 | TESTS | 25 | 30 | 614400 | 1600 | |
111889082 | yao11617 | A | April 3, 2021, 3:01 p.m. | OK | GNU C++11 | TESTS | 25 | 30 | 614400 | 1600 | |
111898893 | just_soso | A | April 3, 2021, 3:16 p.m. | OK | GNU C++11 | TESTS | 25 | 30 | 716800 | 1600 | |
111880439 | starusc | A | April 3, 2021, 2:50 p.m. | OK | GNU C++11 | TESTS | 25 | 30 | 1843200 | 1600 | |
111957674 | luogu_bot3 | A | April 4, 2021, 12:31 a.m. | OK | GNU C++11 | TESTS | 25 | 30 | 2048000 | 1600 | |
111890146 | c8kbf | A | April 3, 2021, 3:03 p.m. | OK | GNU C++11 | TESTS | 25 | 30 | 3481600 | 1600 | |
111890160 | arman_ferdous | A | April 3, 2021, 3:03 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 614400 | 1600 | |
111885786 | cheet0se | A | April 3, 2021, 2:57 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 614400 | 1600 | |
111878934 | scli_weapon | A | April 3, 2021, 2:48 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 614400 | 1600 | |
111878472 | espr1t | A | April 3, 2021, 2:48 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 614400 | 1600 | |
111901856 | RedStar_13 | A | April 3, 2021, 3:22 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 614400 | 1600 | |
111898712 | MancoCapac | A | April 3, 2021, 3:16 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 716800 | 1600 | |
111891060 | elliptic | A | April 3, 2021, 3:04 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 716800 | 1600 | |
111889203 | harshhx17 | A | April 3, 2021, 3:01 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 716800 | 1600 | |
111886266 | iroeid | A | April 3, 2021, 2:57 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 716800 | 1600 | |
111879916 | Devil | A | April 3, 2021, 2:49 p.m. | OK | GNU C++14 | TESTS | 25 | 31 | 716800 | 1600 | |
111878346 | penguinhacker | A | April 3, 2021, 2:47 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 716800 | 1600 | |
111955381 | lrvideckis | A | April 3, 2021, 10:34 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 716800 | 1600 | |
111924729 | sempav | A | April 3, 2021, 4:14 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 716800 | 1600 | |
111888396 | kuzma | A | April 3, 2021, 3 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 716800 | 1600 | |
111885484 | vibhav011 | A | April 3, 2021, 2:56 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 716800 | 1600 | |
111893066 | izone | A | April 3, 2021, 3:07 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 819200 | 1600 | |
111872457 | kizen | A | April 3, 2021, 2:40 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 1126400 | 1600 | |
111880048 | vito1036 | A | April 3, 2021, 2:49 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 1126400 | 1600 | |
111895628 | Delirious_Butter | A | April 3, 2021, 3:11 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 1126400 | 1600 | |
111953915 | Anatoly.ig | A | April 3, 2021, 9:43 p.m. | OK | GNU C++17 | TESTS | 25 | 30 | 1228800 | 1600 | |
111872940 | Heltion | A | April 3, 2021, 2:41 p.m. | OK | GNU C++17 (64) | TESTS | 25 | 30 | 716800 | 1600 | |
111901042 | lelbaba | A | April 3, 2021, 3:20 p.m. | OK | GNU C++17 (64) | TESTS | 25 | 30 | 716800 | 1600 | |
111872331 | jiangly | A | April 3, 2021, 2:39 p.m. | OK | GNU C++17 (64) | TESTS | 25 | 30 | 1126400 | 1600 | |
111873334 | kort0n | A | April 3, 2021, 2:41 p.m. | OK | GNU C++17 (64) | TESTS | 25 | 30 | 1126400 | 1600 | |
111882252 | -zeus- | A | April 3, 2021, 2:52 p.m. | OK | GNU C++17 (64) | TESTS | 25 | 30 | 1126400 | 1600 | |
111910724 | MysteryGuy2 | A | April 3, 2021, 3:40 p.m. | OK | GNU C++17 (64) | TESTS | 25 | 30 | 1126400 | 1600 | |
111967118 | you_dont_know_me | A | April 4, 2021, 5:18 a.m. | OK | GNU C++17 (64) | TESTS | 25 | 30 | 1331200 | 1600 | |
111940870 | yash_daga | A | April 3, 2021, 5:48 p.m. | OK | GNU C++17 (64) | TESTS | 25 | 30 | 4403200 | 1600 | |
111888378 | galen_colin | A | April 3, 2021, 3 p.m. | OK | GNU C++17 (64) | TESTS | 25 | 30 | 24883200 | 1600 | |
111874589 | Kodaman | A | April 3, 2021, 2:43 p.m. | OK | GNU C++17 (64) | TESTS | 25 | 31 | 409600 | 1600 | |
111967972 | 0x3F | A | April 4, 2021, 5:34 a.m. | OK | Go | TESTS | 25 | 31 | 512000 | 1600 | |
111967516 | 0x3F | A | April 4, 2021, 5:26 a.m. | OK | Go | TESTS | 25 | 46 | 512000 | 1600 | |
111899441 | Hemose | A | April 3, 2021, 3:17 p.m. | OK | Java 11 | TESTS | 25 | 202 | 0 | 1600 | |
111884266 | Apfeloxid | A | April 3, 2021, 2:55 p.m. | OK | Java 11 | TESTS | 25 | 202 | 0 | 1600 | |
111887103 | bobib | A | April 3, 2021, 2:58 p.m. | OK | Java 11 | TESTS | 25 | 218 | 0 | 1600 | |
111877627 | nick_301 | A | April 3, 2021, 2:47 p.m. | OK | Java 11 | TESTS | 25 | 218 | 0 | 1600 | |
111872798 | uwi | A | April 3, 2021, 2:40 p.m. | OK | Java 11 | TESTS | 25 | 264 | 0 | 1600 | |
111968044 | blackBird | A | April 4, 2021, 5:35 a.m. | OK | Java 11 | TESTS | 25 | 265 | 5017600 | 1600 | |
111890678 | cirno3153 | A | April 3, 2021, 3:03 p.m. | OK | Java 11 | TESTS | 25 | 295 | 0 | 1600 | |
111882755 | danbanica | A | April 3, 2021, 2:53 p.m. | OK | Java 11 | TESTS | 25 | 452 | 0 | 1600 | |
111932574 | hu_tao | A | April 3, 2021, 4:36 p.m. | OK | Java 8 | TESTS | 25 | 124 | 0 | 1600 | |
111955718 | JunBinLiang | A | April 3, 2021, 10:49 p.m. | OK | Java 8 | TESTS | 25 | 140 | 0 | 1600 | |
111874354 | dalt | A | April 3, 2021, 2:43 p.m. | OK | Java 8 | TESTS | 25 | 140 | 0 | 1600 | |
111885562 | ika | A | April 3, 2021, 2:56 p.m. | OK | Java 8 | TESTS | 25 | 140 | 0 | 1600 | |
111886695 | YahiaSherif | A | April 3, 2021, 2:58 p.m. | OK | Java 8 | TESTS | 25 | 140 | 0 | 1600 | |
111887066 | martins | A | April 3, 2021, 2:58 p.m. | OK | Java 8 | TESTS | 25 | 140 | 0 | 1600 | |
111887855 | polyakoff | A | April 3, 2021, 2:59 p.m. | OK | Java 8 | TESTS | 25 | 140 | 0 | 1600 | |
111883053 | Agnimandur | A | April 3, 2021, 2:53 p.m. | OK | Java 8 | TESTS | 25 | 155 | 0 | 1600 | |
111883780 | 2020akadaver | A | April 3, 2021, 2:54 p.m. | OK | Java 8 | TESTS | 25 | 155 | 0 | 1600 | |
111879725 | golions | A | April 3, 2021, 2:49 p.m. | OK | Java 8 | TESTS | 25 | 171 | 0 | 1600 | |
111883174 | Sergey.Bankevich | A | April 3, 2021, 2:53 p.m. | OK | Kotlin | TESTS | 25 | 124 | 0 | 1600 | |
111877318 | Tlatoani | A | April 3, 2021, 2:46 p.m. | OK | Kotlin | TESTS | 25 | 155 | 0 | 1600 | |
111878477 | arvindf232 | A | April 3, 2021, 2:48 p.m. | OK | Kotlin | TESTS | 25 | 171 | 716800 | 1600 | |
111889407 | alexey.enkov | A | April 3, 2021, 3:02 p.m. | OK | Kotlin | TESTS | 25 | 374 | 102400 | 1600 | |
111881930 | vpike | A | April 3, 2021, 2:52 p.m. | OK | MS C++ 2017 | TESTS | 25 | 46 | 819200 | 1600 | |
111890464 | tarattata1 | A | April 3, 2021, 3:03 p.m. | OK | MS C++ 2017 | TESTS | 25 | 46 | 4608000 | 1600 | |
111940300 | hyoseok | A | April 3, 2021, 5:44 p.m. | OK | MS C++ 2017 | TESTS | 25 | 93 | 614400 | 1600 | |
111966574 | XieJiaXuan | A | April 4, 2021, 5:09 a.m. | OK | MS C++ 2017 | TESTS | 25 | 124 | 819200 | 1600 | |
111965207 | XieJiaXuan | A | April 4, 2021, 4:34 a.m. | OK | MS C++ 2017 | TESTS | 25 | 140 | 819200 | 1600 | |
111879804 | mban259 | A | April 3, 2021, 2:49 p.m. | OK | .NET Core C# | TESTS | 25 | 108 | 2969600 | 1600 | |
111884613 | Yupiteru | A | April 3, 2021, 2:55 p.m. | OK | .NET Core C# | TESTS | 25 | 109 | 13619200 | 1600 | |
111880503 | fairy_lettuce | A | April 3, 2021, 2:50 p.m. | OK | .NET Core C# | TESTS | 25 | 124 | 8704000 | 1600 | |
111876193 | keymoon | A | April 3, 2021, 2:45 p.m. | OK | .NET Core C# | TESTS | 25 | 155 | 3276800 | 1600 | |
111881385 | .I. | A | April 3, 2021, 2:51 p.m. | OK | .NET Core C# | TESTS | 25 | 155 | 3276800 | 1600 | |
111956764 | watarimaycry2 | A | April 3, 2021, 11:44 p.m. | OK | Node.js | TESTS | 25 | 108 | 15360000 | 1600 | |
111877364 | dolphinigle | A | April 3, 2021, 2:46 p.m. | OK | PyPy 2 | TESTS | 25 | 124 | 5734400 | 1600 | |
111881746 | conqueror_of_tourist | A | April 3, 2021, 2:51 p.m. | OK | PyPy 3 | TESTS | 25 | 155 | 10649600 | 1600 | |
111893540 | FlakeLCR | A | April 3, 2021, 3:08 p.m. | OK | PyPy 3 | TESTS | 25 | 187 | 17715200 | 1600 | |
111875760 | kclee2172 | A | April 3, 2021, 2:44 p.m. | OK | PyPy 3 | TESTS | 25 | 202 | 6758400 | 1600 | |
111897613 | VTifand | A | April 3, 2021, 3:14 p.m. | OK | PyPy 3 | TESTS | 25 | 202 | 9420800 | 1600 | |
111879301 | SPD_9X2 | A | April 3, 2021, 2:49 p.m. | OK | PyPy 3 | TESTS | 25 | 202 | 10342400 | 1600 | |
111876105 | titia | A | April 3, 2021, 2:45 p.m. | OK | PyPy 3 | TESTS | 25 | 202 | 13004800 | 1600 | |
111880030 | tamato | A | April 3, 2021, 2:49 p.m. | OK | PyPy 3 | TESTS | 25 | 218 | 10547200 | 1600 | |
111878618 | Kiri8128 | A | April 3, 2021, 2:48 p.m. | OK | PyPy 3 | TESTS | 25 | 218 | 11059200 | 1600 | |
111874753 | i8nd5t | A | April 3, 2021, 2:43 p.m. | OK | PyPy 3 | TESTS | 25 | 218 | 15155200 | 1600 | |
111943185 | oadey89 | A | April 3, 2021, 6:10 p.m. | OK | PyPy 3 | TESTS | 25 | 233 | 11673600 | 1600 | |
111878715 | nwi | A | April 3, 2021, 2:48 p.m. | OK | Python 2 | TESTS | 25 | 171 | 2252800 | 1600 | |
111886985 | kwangg | A | April 3, 2021, 2:58 p.m. | OK | Python 3 | TESTS | 25 | 280 | 5017600 | 1600 | |
111957677 | mkawa2 | A | April 4, 2021, 12:31 a.m. | OK | Python 3 | TESTS | 25 | 296 | 8704000 | 1600 | |
111886828 | cottoncotton | A | April 3, 2021, 2:58 p.m. | OK | Rust | TESTS | 25 | 31 | 1126400 | 1600 | |
111875736 | sansen | A | April 3, 2021, 2:44 p.m. | OK | Rust | TESTS | 25 | 46 | 1331200 | 1600 | |
111874548 | toomer | A | April 3, 2021, 2:43 p.m. | OK | Rust | TESTS | 25 | 46 | 3993600 | 1600 | |
111893084 | bottomcoder | A | April 3, 2021, 3:07 p.m. | OK | Rust | TESTS | 25 | 280 | 3686400 | 1600 | |
111876029 | ngtkana | A | April 3, 2021, 2:45 p.m. | OK | Rust | TESTS | 25 | 343 | 1024000 | 1600 | |
111905599 | Russell_Emerine | A | April 3, 2021, 3:29 p.m. | OK | Rust | TESTS | 25 | 358 | 8806400 | 1600 |
Back to search problems