Codeforces Round 789 (Div. 2)

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
1678 Codeforces Round 789 (Div. 2) FINISHED False 7200 85159463 May 8, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6724 ) B2 Tokitsukaze and Good 01-String (hard version) PROGRAMMING dp implementation

B'This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments. Tokitsukaze has a binary string s of length n , consisting only of zeros and ones, n is even. Now Tokitsukaze divides s into the minimum number of contiguous subsegments, and for each subsegment, all bits in each subsegment are the same. After that, s is considered good if the lengths of all subsegments are even. For example, if s is "11001111", it will be divided into "11", "00" and "1111". Their lengths are 2 , 2 , 4 respectively, which are all even numbers, so "11001111" is good. Another example, if s is "1110011000", it will be divided into "111", "00", "11" and "000", and their lengths are 3 , 2 , 2 , 3 . Obviously, "1110011000" is not good. Tokitsukaze wants to make s good by changing the values of some positions in s . Specifically, she can perform the operation any number of times: change the value of s_i to '0 ' or '1 ' ( 1 <= q i <= q n ). Can you tell her the minimum number of operations to make s good? Meanwhile, she also wants to know the minimum number of subsegments that s can be divided into among all solutions with the minimum number of operations. The first contains a single positive integer t ( 1 <= q t <= q 10 ,000 ) -- the number of test cases. For each test case, the first line contains a single integer n ( 2 <= q n <= q 2 cdot 10^5 ) -- the length of s , it is guaranteed that n is even. The second line contains a binary string s of length n , consisting only of zeros and ones. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print a single line with two integers -- the minimum number of operations to make s good, and the minimum number of sub'...

Tutorials

Codeforces Round 789 Chinese Tutorial.pdf

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
156354067 dean.menezes B2 May 8, 2022, 5:51 p.m. OK GNU C11 TESTS 25 46 204800
156358887 YOK B2 May 8, 2022, 6:57 p.m. OK GNU C11 TESTS 25 62 409600
156370425 chumeng B2 May 9, 2022, 12:09 a.m. OK GNU C++14 TESTS 25 15 0
156377323 _chess_ B2 May 9, 2022, 3:13 a.m. OK GNU C++14 TESTS 25 15 204800
156376300 _ajthreac_ B2 May 9, 2022, 2:49 a.m. OK GNU C++14 TESTS 25 15 204800
156372483 mohen B2 May 9, 2022, 1:24 a.m. OK GNU C++14 TESTS 25 15 204800
156371225 nnjkk B2 May 9, 2022, 12:39 a.m. OK GNU C++14 TESTS 25 15 204800
156380388 AIM-9X B2 May 9, 2022, 4:28 a.m. OK GNU C++14 TESTS 25 15 204800
156379710 luciannguyen07 B2 May 9, 2022, 4:11 a.m. OK GNU C++14 TESTS 25 15 204800
156379233 atharva_0307 B2 May 9, 2022, 4 a.m. OK GNU C++14 TESTS 25 15 204800
156383767 _whb B2 May 9, 2022, 5:38 a.m. OK GNU C++14 TESTS 25 15 204800
156382601 0xcc B2 May 9, 2022, 5:17 a.m. OK GNU C++14 TESTS 25 15 204800
156380114 vivek_yamsani B2 May 9, 2022, 4:21 a.m. OK GNU C++17 TESTS 25 0 512000
156372456 catsareliquid B2 May 9, 2022, 1:23 a.m. OK GNU C++17 TESTS 25 15 204800
156362314 giegie B2 May 8, 2022, 7:55 p.m. OK GNU C++17 TESTS 25 15 204800
156353523 _skb_ B2 May 8, 2022, 5:45 p.m. OK GNU C++17 TESTS 25 15 204800
156353413 mehtaji B2 May 8, 2022, 5:43 p.m. OK GNU C++17 TESTS 25 15 204800
156352223 lovyamyppm B2 May 8, 2022, 5:31 p.m. OK GNU C++17 TESTS 25 15 204800
156351843 AINgray B2 May 8, 2022, 5:28 p.m. OK GNU C++17 TESTS 25 15 204800
156378454 Beginner343 B2 May 9, 2022, 3:41 a.m. OK GNU C++17 TESTS 25 15 204800
156373825 sanskar.sharma B2 May 9, 2022, 2:03 a.m. OK GNU C++17 TESTS 25 15 204800
156353761 paga2004 B2 May 8, 2022, 5:47 p.m. OK GNU C++17 TESTS 25 15 409600
156344304 Chime B2 May 8, 2022, 4:22 p.m. OK GNU C++17 (64) TESTS 25 15 204800
156375684 panyanppyy B2 May 9, 2022, 2:33 a.m. OK GNU C++17 (64) TESTS 25 15 204800
156355793 propane B2 May 8, 2022, 6:11 p.m. OK GNU C++17 (64) TESTS 25 15 409600
156379720 manoj.gtr B2 May 9, 2022, 4:11 a.m. OK GNU C++17 (64) TESTS 25 15 512000
156384722 Mxrush B2 May 9, 2022, 5:58 a.m. OK GNU C++17 (64) TESTS 25 15 512000
156384125 Asad5059 B2 May 9, 2022, 5:46 a.m. OK GNU C++17 (64) TESTS 25 15 512000
156383618 Candy.01 B2 May 9, 2022, 5:35 a.m. OK GNU C++17 (64) TESTS 25 15 512000
156381648 soumyadeep_pal_21 B2 May 9, 2022, 4:57 a.m. OK GNU C++17 (64) TESTS 25 15 512000
156381026 Graphter B2 May 9, 2022, 4:42 a.m. OK GNU C++17 (64) TESTS 25 15 512000
156379330 vjudge4 B2 May 9, 2022, 4:02 a.m. OK GNU C++17 (64) TESTS 25 15 512000
156361104 Abo_Samrah B2 May 8, 2022, 7:33 p.m. OK GNU C++20 (64) TESTS 25 0 512000
156384816 Misbaul_Hasan B2 May 9, 2022, 6 a.m. OK GNU C++20 (64) TESTS 25 0 512000
156363040 apoorv_me B2 May 8, 2022, 8:10 p.m. OK GNU C++20 (64) TESTS 25 0 2150400
156381360 brokencup B2 May 9, 2022, 4:50 a.m. OK GNU C++20 (64) TESTS 25 15 0
156351512 fishcathu. B2 May 8, 2022, 5:26 p.m. OK GNU C++20 (64) TESTS 25 15 0
156379218 -Victory B2 May 9, 2022, 3:59 a.m. OK GNU C++20 (64) TESTS 25 15 204800
156369139 jelly-ice B2 May 8, 2022, 11:17 p.m. OK GNU C++20 (64) TESTS 25 15 204800
156358033 mihneacazan B2 May 8, 2022, 6:43 p.m. OK GNU C++20 (64) TESTS 25 15 204800
156372487 ShivanshJ B2 May 9, 2022, 1:24 a.m. OK GNU C++20 (64) TESTS 25 15 409600
156377245 not_alone B2 May 9, 2022, 3:12 a.m. OK GNU C++20 (64) TESTS 25 15 409600
156354838 MrOtter B2 May 8, 2022, 6 p.m. OK Java 11 TESTS 25 186 0
156344986 csharpe B2 May 8, 2022, 4:25 p.m. OK Java 11 TESTS 25 186 0
156384802 krishnagskr983 B2 May 9, 2022, 6 a.m. OK Java 11 TESTS 25 187 0
156380611 souvik2000 B2 May 9, 2022, 4:33 a.m. OK Java 11 TESTS 25 187 0
156362533 mahmoud_hosam B2 May 8, 2022, 8 p.m. OK Java 11 TESTS 25 187 0
156384258 csullivan203 B2 May 9, 2022, 5:49 a.m. OK Java 11 TESTS 25 202 0
156372174 vj98 B2 May 9, 2022, 1:14 a.m. OK Java 11 TESTS 25 202 0
156370370 LongWalk B2 May 9, 2022, 12:07 a.m. OK Java 11 TESTS 25 202 0
156356999 Heisenburg-120 B2 May 8, 2022, 6:27 p.m. OK Java 11 TESTS 25 202 0
156355199 MatthewRaker B2 May 8, 2022, 6:04 p.m. OK Java 11 TESTS 25 202 0
156378851 sharpen B2 May 9, 2022, 3:51 a.m. OK Java 8 TESTS 25 93 0
156378275 lcheeme1 B2 May 9, 2022, 3:37 a.m. OK Java 8 TESTS 25 109 0
156352596 govindrajput B2 May 8, 2022, 5:35 p.m. OK Java 8 TESTS 25 109 0
156343083 g906360 B2 May 8, 2022, 4:18 p.m. OK Java 8 TESTS 25 124 0
156382110 13125003809 B2 May 9, 2022, 5:07 a.m. OK Java 8 TESTS 25 140 0
156356785 rish1896 B2 May 8, 2022, 6:24 p.m. OK Java 8 TESTS 25 155 0
156380696 amit_roy B2 May 9, 2022, 4:35 a.m. OK Java 8 TESTS 25 155 19353600
156380407 ikillmyself B2 May 9, 2022, 4:29 a.m. OK Java 8 TESTS 25 233 0
156346842 vikaspanwar11 B2 May 8, 2022, 4:30 p.m. OK Java 8 TESTS 25 249 0
156365423 thegeman B2 May 8, 2022, 9:09 p.m. OK Kotlin 1.6 TESTS 25 233 0
156351286 xsc B2 May 8, 2022, 5:25 p.m. OK MS C++ 2017 TESTS 25 15 614400
156374525 jianguolinyun B2 May 9, 2022, 2:22 a.m. OK MS C++ 2017 TESTS 25 31 204800
156362613 Enternal B2 May 8, 2022, 8:01 p.m. OK MS C++ 2017 TESTS 25 46 614400
156339514 Jilliana B2 May 8, 2022, 4:06 p.m. OK MS C++ 2017 TESTS 25 155 1024000
156351190 1_2_3_4_5_9 B2 May 8, 2022, 5:24 p.m. OK PyPy 2 TESTS 25 140 6246400
156372529 FrozenKandy B2 May 9, 2022, 1:25 a.m. OK PyPy 3 TESTS 25 155 8601600
156374467 arpan.parikh B2 May 9, 2022, 2:21 a.m. OK PyPy 3 TESTS 25 155 71372800
156339631 immike B2 May 8, 2022, 4:07 p.m. OK PyPy 3 TESTS 25 170 21401600
156347646 aa2 B2 May 8, 2022, 4:32 p.m. OK PyPy 3 TESTS 25 342 6656000
156370674 mohanned_war B2 May 9, 2022, 12:18 a.m. OK PyPy 3 TESTS 25 405 9113600
156347212 u1602016 B2 May 8, 2022, 4:31 p.m. OK PyPy 3 TESTS 25 421 9216000
156350604 iron_nicko B2 May 8, 2022, 5:22 p.m. OK PyPy 3-64 TESTS 25 93 4915200
156357530 davidchi B2 May 8, 2022, 6:35 p.m. OK PyPy 3-64 TESTS 25 93 6246400
156357078 shekhawat_rss B2 May 8, 2022, 6:28 p.m. OK PyPy 3-64 TESTS 25 124 15052800
156352870 mintplz B2 May 8, 2022, 5:38 p.m. OK PyPy 3-64 TESTS 25 140 16588800
156337774 Ahmed_Turkman B2 May 8, 2022, 4:01 p.m. OK PyPy 3-64 TESTS 25 171 24166400
156364969 deepanshu_pali B2 May 8, 2022, 8:56 p.m. OK PyPy 3-64 TESTS 25 187 16998400
156371744 NODAX B2 May 9, 2022, 12:59 a.m. OK PyPy 3-64 TESTS 25 202 16691200
156359852 _MADARA_ B2 May 8, 2022, 7:12 p.m. OK PyPy 3-64 TESTS 25 218 9318400
156369756 IkshitG B2 May 8, 2022, 11:41 p.m. OK PyPy 3-64 TESTS 25 233 19660800
156360087 alex_mat B2 May 8, 2022, 7:16 p.m. OK PyPy 3-64 TESTS 25 249 12390400
156359163 PMiguelez B2 May 8, 2022, 7:01 p.m. OK Python 3 TESTS 25 93 512000
156342536 RishabhVarshney B2 May 8, 2022, 4:17 p.m. OK Python 3 TESTS 25 124 2048000
156364360 sushant_7580 B2 May 8, 2022, 8:41 p.m. OK Python 3 TESTS 25 139 204800
156339506 aayushraturi B2 May 8, 2022, 4:06 p.m. OK Python 3 TESTS 25 155 512000
156362258 Nadush914 B2 May 8, 2022, 7:54 p.m. OK Python 3 TESTS 25 155 716800
156341064 shivang257 B2 May 8, 2022, 4:12 p.m. OK Python 3 TESTS 25 186 512000
156341890 edwardzhang2 B2 May 8, 2022, 4:14 p.m. OK Python 3 TESTS 25 187 1126400
156342622 jamesbansal24jan B2 May 8, 2022, 4:17 p.m. OK Python 3 TESTS 25 187 1228800
156365631 jamesbansal24jan B2 May 8, 2022, 9:15 p.m. OK Python 3 TESTS 25 202 1228800
156356798 shokal_kishan B2 May 8, 2022, 6:24 p.m. OK Python 3 TESTS 25 202 2560000
156371662 Spheniscine B2 May 9, 2022, 12:56 a.m. OK Rust 2021 TESTS 25 15 307200

remove filters

Back to search problems