Codeforces Round 661 (Div. 3)

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
1399 Codeforces Round 661 (Div. 3) FINISHED False 8100 135185099 Aug. 5, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 18376 ) D Binary String To Subsequences PROGRAMMING constructive algorithms data structures greedy

B'You are given a binary string s consisting of n zeros and ones. Your task is to divide the given string into the minimum number of subsequences in such a way that each character of the string belongs to exactly one subsequence and each subsequence looks like "010101 ..." or "101010 ..." (i.e. the subsequence should not contain two adjacent zeros or ones). Recall that a subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements. For example, subsequences of "1011101" are "0", "1", "11111", "0111", "101", "1001", but not "000", "101010" and "11100". You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 2 cdot 10^4 ) -- the number of test cases. Then t test cases follow. The first line of the test case contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the length of s . The second line of the test case contains n characters '0 ' and '1 ' -- the string s . It is guaranteed that the sum of n does not exceed 2 cdot 10^5 ( sum n <= 2 cdot 10^5 ). For each test case, print the answer: in the first line print one integer k ( 1 <= k <= n ) -- the minimum number of subsequences you can divide the string s to. In the second line print n integers a_1, a_2, ... , a_n ( 1 <= a_i <= k ), where a_i is the number of subsequence the i -th character of s belongs to. If there are several answers, you can print any. '...

Tutorials

Codeforces Round #661 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
90183614 agibson D Aug. 17, 2020, 1:10 a.m. OK D TESTS 24 171 24473600
90078721 Chreonix D Aug. 16, 2020, 11:45 a.m. OK GNU C11 TESTS 24 764 204800
90060734 Fir_Creek D Aug. 16, 2020, 6:20 a.m. OK GNU C++11 TESTS 24 61 1945600
90760533 xiahongyu D Aug. 23, 2020, 1:49 p.m. OK GNU C++11 TESTS 24 61 7270400
90878731 PhoenixWright666 D Aug. 25, 2020, 7:40 a.m. OK GNU C++11 TESTS 24 62 1843200
90878829 PhoenixWright666 D Aug. 25, 2020, 7:41 a.m. OK GNU C++11 TESTS 24 62 1843200
91196123 Xiaolu.L D Aug. 28, 2020, 9:36 a.m. OK GNU C++11 TESTS 24 62 1945600
91138291 luogu_bot4 D Aug. 27, 2020, 1:51 p.m. OK GNU C++11 TESTS 24 62 1945600
90426533 ivanovcraft D Aug. 20, 2020, 1:40 a.m. OK GNU C++11 TESTS 24 62 1945600
90193993 Blingpig D Aug. 17, 2020, 4:57 a.m. OK GNU C++11 TESTS 24 62 1945600
90061118 Fir_Creek D Aug. 16, 2020, 6:28 a.m. OK GNU C++11 TESTS 24 62 1945600
91294193 rain_Isle D Aug. 29, 2020, 3:06 p.m. OK GNU C++11 TESTS 24 62 1945600
90200123 pranne1224 D Aug. 17, 2020, 6:27 a.m. OK GNU C++14 TESTS 24 46 4403200
90734853 Willem D Aug. 23, 2020, 7:23 a.m. OK GNU C++14 TESTS 24 46 9728000
91681825 DOT.S0110 D Sept. 3, 2020, 2:09 a.m. OK GNU C++14 TESTS 24 61 1843200
91706269 rjcb D Sept. 3, 2020, 10 a.m. OK GNU C++14 TESTS 24 61 2560000
90251338 yanghaomai D Aug. 17, 2020, 5:12 p.m. OK GNU C++14 TESTS 24 61 2662400
90456294 utkarsh.37 D Aug. 20, 2020, 11:04 a.m. OK GNU C++14 TESTS 24 61 2764800
91613873 ksohita D Sept. 2, 2020, 5:36 a.m. OK GNU C++14 TESTS 24 61 3276800
91388831 oipotato D Aug. 30, 2020, 3:35 p.m. OK GNU C++14 TESTS 24 61 6451200
90370167 wework D Aug. 19, 2020, 8:11 a.m. OK GNU C++14 TESTS 24 62 2150400
91055409 HyDreamer D Aug. 26, 2020, 1:18 p.m. OK GNU C++14 TESTS 24 62 2150400
90393862 31801159 D Aug. 19, 2020, 1:51 p.m. OK GNU C++17 TESTS 24 61 2048000
90426050 Dating D Aug. 20, 2020, 1:19 a.m. OK GNU C++17 TESTS 24 61 2560000
91523628 isa67719 D Aug. 31, 2020, 8:46 p.m. OK GNU C++17 TESTS 24 61 2662400
90033289 Pachecor D Aug. 15, 2020, 4:12 p.m. OK GNU C++17 TESTS 24 61 2969600
91619467 ali.naserinia D Sept. 2, 2020, 7:09 a.m. OK GNU C++17 TESTS 24 61 3276800
90488281 dshahid380 D Aug. 20, 2020, 6:12 p.m. OK GNU C++17 TESTS 24 61 3276800
90070592 multimuvies D Aug. 16, 2020, 9:11 a.m. OK GNU C++17 TESTS 24 61 3276800
90408459 foldl D Aug. 19, 2020, 4:58 p.m. OK GNU C++17 TESTS 24 61 3891200
89994481 TheThirdOne D Aug. 15, 2020, 6:59 a.m. OK GNU C++17 TESTS 24 61 3891200
90788982 kpeng815 D Aug. 24, 2020, 1:08 a.m. OK GNU C++17 TESTS 24 61 5836800
90288763 Don_McMeMad D Aug. 18, 2020, 8:07 a.m. OK GNU C++17 (64) TESTS 24 46 2048000
90446945 dynam1c D Aug. 20, 2020, 8:41 a.m. OK GNU C++17 (64) TESTS 24 46 2048000
91501266 IMCV D Aug. 31, 2020, 2:48 p.m. OK GNU C++17 (64) TESTS 24 46 2969600
90907458 smigwump D Aug. 25, 2020, 2:27 p.m. OK GNU C++17 (64) TESTS 24 46 2969600
90878204 Linter97 D Aug. 25, 2020, 7:32 a.m. OK GNU C++17 (64) TESTS 24 46 2969600
90041080 elyutin159164 D Aug. 15, 2020, 6:39 p.m. OK GNU C++17 (64) TESTS 24 46 2969600
91693622 Scissors_Ss D Sept. 3, 2020, 6:46 a.m. OK GNU C++17 (64) TESTS 24 46 2969600
91672345 Phortox D Sept. 2, 2020, 8:05 p.m. OK GNU C++17 (64) TESTS 24 46 3379200
90029936 raaghavraaj D Aug. 15, 2020, 3:23 p.m. OK GNU C++17 (64) TESTS 24 46 6246400
91249709 ir_1st_vil D Aug. 29, 2020, 1:10 a.m. OK GNU C++17 (64) TESTS 24 62 1945600
90521159 CtrlCV D Aug. 21, 2020, 9:56 a.m. OK Go TESTS 24 1621 15564800
90499219 B_w_c D Aug. 20, 2020, 11:15 p.m. OK Haskell TESTS 24 77 12697600
90018413 Boryan07 D Aug. 15, 2020, 12:34 p.m. OK Java 11 TESTS 24 249 0
90425337 big_boy_coder D Aug. 20, 2020, 12:48 a.m. OK Java 11 TESTS 24 264 7475200
91195657 xapcloud D Aug. 28, 2020, 9:27 a.m. OK Java 11 TESTS 24 265 12288000
90333340 TheManWithNoName D Aug. 18, 2020, 5:35 p.m. OK Java 11 TESTS 24 327 39219200
90765092 kartikeysemwal D Aug. 23, 2020, 2:48 p.m. OK Java 11 TESTS 24 342 32153600
90023855 sks_saurav D Aug. 15, 2020, 1:59 p.m. OK Java 11 TESTS 24 468 7065600
91092895 stormovik D Aug. 26, 2020, 10:10 p.m. OK Java 11 TESTS 24 498 18534400
90380865 hamsterp D Aug. 19, 2020, 10:50 a.m. OK Java 11 TESTS 24 514 2867200
90235436 zohan_ash D Aug. 17, 2020, 2:07 p.m. OK Java 11 TESTS 24 561 6553600
90519911 cribabby D Aug. 21, 2020, 9:37 a.m. OK Java 11 TESTS 24 561 48640000
90051376 AnandOza D Aug. 16, 2020, 1:38 a.m. OK Java 8 TESTS 24 155 2457600
90706635 mu.shakhawat.hossain D Aug. 22, 2020, 5:17 p.m. OK Java 8 TESTS 24 155 29696000
91237668 coder_freak D Aug. 28, 2020, 6:44 p.m. OK Java 8 TESTS 24 171 0
90185953 vjudge4 D Aug. 17, 2020, 2:20 a.m. OK Java 8 TESTS 24 171 9625600
90509891 srvptk97 D Aug. 21, 2020, 7:20 a.m. OK Java 8 TESTS 24 171 25600000
90662269 Mihir_Gajera1 D Aug. 22, 2020, 6:50 a.m. OK Java 8 TESTS 24 171 43520000
91680888 the_final_problem D Sept. 3, 2020, 1:30 a.m. OK Java 8 TESTS 24 186 3788800
90730342 KadenXu D Aug. 23, 2020, 6:04 a.m. OK Java 8 TESTS 24 186 28979200
90245090 Juniper D Aug. 17, 2020, 3:53 p.m. OK Java 8 TESTS 24 187 5529600
90436056 Me146 D Aug. 20, 2020, 5:54 a.m. OK Java 8 TESTS 24 202 3993600
90404837 cmplx-xyttmt D Aug. 19, 2020, 4:04 p.m. OK Kotlin TESTS 24 436 5427200
91586510 Mirimax D Sept. 1, 2020, 4:57 p.m. OK Kotlin TESTS 24 935 0
90068630 Jothef D Aug. 16, 2020, 8:36 a.m. OK Kotlin TESTS 24 982 13516800
91584494 hhsaffar D Sept. 1, 2020, 4:31 p.m. OK Mono C# TESTS 24 187 11878400
91318029 0Mordecai0 D Aug. 30, 2020, 1:45 a.m. OK MS C++ 2017 TESTS 24 140 2560000
90463928 dixmw34 D Aug. 20, 2020, 12:58 p.m. OK MS C++ 2017 TESTS 24 156 2867200
91602658 concept3d D Sept. 1, 2020, 11:24 p.m. OK MS C++ 2017 TESTS 24 171 3891200
90688926 Gadi D Aug. 22, 2020, 12:59 p.m. OK MS C++ 2017 TESTS 24 171 6963200
90670616 Still_Theory D Aug. 22, 2020, 8:36 a.m. OK MS C++ 2017 TESTS 24 218 11264000
90514130 544432 D Aug. 21, 2020, 8:17 a.m. OK MS C++ 2017 TESTS 24 218 11264000
90473306 aalakhtin D Aug. 20, 2020, 2:53 p.m. OK MS C++ 2017 TESTS 24 233 8089600
91704542 gao_wu_di D Sept. 3, 2020, 9:34 a.m. OK MS C++ 2017 TESTS 24 265 2560000
90523410 CFWudanna D Aug. 21, 2020, 10:32 a.m. OK MS C++ 2017 TESTS 24 265 6758400
90439515 Sherlock_An D Aug. 20, 2020, 6:51 a.m. OK MS C++ 2017 TESTS 24 280 2560000
91283291 yumtam D Aug. 29, 2020, 12:16 p.m. OK PyPy 2 TESTS 24 171 12492800
90835360 2019ucp1350 D Aug. 24, 2020, 2:40 p.m. OK PyPy 3 TESTS 24 202 32768000
90203052 tanzilidrisi68 D Aug. 17, 2020, 7:07 a.m. OK PyPy 3 TESTS 24 311 13926400
90411090 foratbahrani D Aug. 19, 2020, 5:39 p.m. OK PyPy 3 TESTS 24 311 14848000
90424354 Achilles221B D Aug. 19, 2020, 11:56 p.m. OK PyPy 3 TESTS 24 311 19046400
90805727 DrTrue D Aug. 24, 2020, 7:50 a.m. OK PyPy 3 TESTS 24 327 34201600
90601631 MarkZh D Aug. 21, 2020, 4 p.m. OK PyPy 3 TESTS 24 327 47616000
90004190 Omega98 D Aug. 15, 2020, 9:03 a.m. OK PyPy 3 TESTS 24 374 10956800
90909681 tanon710 D Aug. 25, 2020, 2:38 p.m. OK PyPy 3 TESTS 24 561 15155200
90186455 YMSeah D Aug. 17, 2020, 2:32 a.m. OK PyPy 3 TESTS 24 607 15360000
90869041 whatshisbucket D Aug. 25, 2020, 5:06 a.m. OK PyPy 3 TESTS 24 607 20172800
91052868 ComptineDunAutreEte D Aug. 26, 2020, 12:54 p.m. OK Python 2 TESTS 24 858 8908800
90732391 orailly D Aug. 23, 2020, 6:43 a.m. OK Python 3 TESTS 24 295 22630400
90700807 AlifArifin D Aug. 22, 2020, 3:47 p.m. OK Python 3 TESTS 24 405 19558400
90283987 MingKang D Aug. 18, 2020, 6:59 a.m. OK Python 3 TESTS 24 452 16896000
90866368 ajnatarajan D Aug. 25, 2020, 4:08 a.m. OK Python 3 TESTS 24 483 16281600
91334797 Firebat D Aug. 30, 2020, 10:41 a.m. OK Python 3 TESTS 24 498 22016000
90726871 smartin D Aug. 23, 2020, 4:31 a.m. OK Python 3 TESTS 24 498 25088000
90467075 ThetaSigma D Aug. 20, 2020, 1:40 p.m. OK Python 3 TESTS 24 546 8192000
90206328 tanmay1501 D Aug. 17, 2020, 7:50 a.m. OK Python 3 TESTS 24 561 9011200
90741932 prokofitch D Aug. 23, 2020, 9:15 a.m. OK Python 3 TESTS 24 561 24985600
90694242 arsinator D Aug. 22, 2020, 2:16 p.m. OK Python 3 TESTS 24 576 27648000

remove filters

Back to search problems