Codeforces Round 658 (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
1381 Codeforces Round 658 (Div. 1) FINISHED False 7200 142961091 July 21, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 13486 ) A2 Prefix Flip (Hard Version) PROGRAMMING constructive algorithms data structures strings two pointers 1700

B'This is the hard version of the problem. The difference between the versions is the constraint on n and the required number of operations. You can make hacks only if all versions of the problem are solved. There are two binary strings a and b of length n (a binary string is a string consisting of symbols 0 and 1 ). In an operation, you select a prefix of a , and simultaneously invert the bits in the prefix ( 0 changes to 1 and 1 changes to 0 ) and reverse the order of the bits in the prefix. For example, if a=001011 and you select the prefix of length 3 , it becomes 011011 . Then if you select the entire string, it becomes 001001 . Your task is to transform the string a into b in at most 2n operations. It can be proved that it is always possible. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. Next 3t lines contain descriptions of test cases. The first line of each test case contains a single integer n ( 1 <= n <= 10^5 ) -- the length of the binary strings. The next two lines contain two binary strings a and b of length n . It is guaranteed that the sum of n across all test cases does not exceed 10^5 . For each test case, output an integer k ( 0 <= k <= 2n ), followed by k integers p_1, ldots,p_k ( 1 <= p_i <= n ). Here k is the number of operations you use and p_i is the length of the prefix you flip in the i -th operation. In the first test case, we have 01 to 11 to 00 to 10 . In the second test case, we have 01011 to 00101 to 11101 to 01000 to 10100 to 00100 to 11100 . In the third test case, the strings are already the same. Another solution is to flip the prefix of length 2 , which will leave a unchanged. '...

Tutorials

Codeforces Round #658 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
87544693 Gassa A2 July 21, 2020, 3 p.m. OK D TESTS 20 62 10854400 1700
87549668 daut-dlang A2 July 21, 2020, 3:07 p.m. OK D TESTS 20 62 18432000 1700
87541394 hos.lyric A2 July 21, 2020, 2:55 p.m. OK D TESTS 20 77 10854400 1700
87531595 1207koo A2 July 21, 2020, 2:44 p.m. OK GNU C11 TESTS 20 561 4710400 1700
87542720 about A2 July 21, 2020, 2:57 p.m. OK GNU C11 TESTS 20 592 4710400 1700
87575665 __Salty__ A2 July 21, 2020, 3:55 p.m. OK GNU C++11 TESTS 20 31 5632000 1700
87534644 LJC00118 A2 July 21, 2020, 2:47 p.m. OK GNU C++11 TESTS 20 31 5632000 1700
87551405 linyizhou A2 July 21, 2020, 3:10 p.m. OK GNU C++11 TESTS 20 31 5734400 1700
87550306 deafff A2 July 21, 2020, 3:08 p.m. OK GNU C++11 TESTS 20 31 6144000 1700
87535725 s_r_f A2 July 21, 2020, 2:48 p.m. OK GNU C++11 TESTS 20 31 6348800 1700
87554400 Wall_breaker A2 July 21, 2020, 3:15 p.m. OK GNU C++11 TESTS 20 31 6451200 1700
87538608 hs-black A2 July 21, 2020, 2:52 p.m. OK GNU C++11 TESTS 20 31 8396800 1700
87546968 stefansav A2 July 21, 2020, 3:03 p.m. OK GNU C++11 TESTS 20 46 4710400 1700
87630073 zlczlc A2 July 22, 2020, 3:56 a.m. OK GNU C++11 TESTS 20 46 4710400 1700
87558513 DarkoLoveRuby A2 July 21, 2020, 3:22 p.m. OK GNU C++11 TESTS 20 46 4710400 1700
87571499 Spanta A2 July 21, 2020, 3:46 p.m. OK GNU C++14 TESTS 20 31 4710400 1700
87602075 sshubhamsoni A2 July 21, 2020, 6:05 p.m. OK GNU C++14 TESTS 20 31 4915200 1700
87624055 KbMu A2 July 22, 2020, 1:49 a.m. OK GNU C++14 TESTS 20 31 4915200 1700
87580153 hk-cnyali A2 July 21, 2020, 4:05 p.m. OK GNU C++14 TESTS 20 31 5120000 1700
87536281 Torta A2 July 21, 2020, 2:49 p.m. OK GNU C++14 TESTS 20 31 5529600 1700
87551760 mindol A2 July 21, 2020, 3:11 p.m. OK GNU C++14 TESTS 20 31 5529600 1700
87554305 qx4ever A2 July 21, 2020, 3:15 p.m. OK GNU C++14 TESTS 20 31 5529600 1700
87577159 Linkus A2 July 21, 2020, 3:58 p.m. OK GNU C++14 TESTS 20 31 5632000 1700
87552215 zzynb A2 July 21, 2020, 3:11 p.m. OK GNU C++14 TESTS 20 31 5734400 1700
87555535 Bedo_Sayed A2 July 21, 2020, 3:17 p.m. OK GNU C++14 TESTS 20 31 6041600 1700
87528331 SHZhang2 A2 July 21, 2020, 2:41 p.m. OK GNU C++17 TESTS 20 31 4710400 1700
87534512 atodo A2 July 21, 2020, 2:47 p.m. OK GNU C++17 TESTS 20 31 4812800 1700
87633295 rotoZOOM A2 July 22, 2020, 4:54 a.m. OK GNU C++17 TESTS 20 31 4915200 1700
87547734 some_username A2 July 21, 2020, 3:04 p.m. OK GNU C++17 TESTS 20 31 5120000 1700
87542440 ikalev111 A2 July 21, 2020, 2:57 p.m. OK GNU C++17 TESTS 20 31 5120000 1700
87534680 Lemur95 A2 July 21, 2020, 2:47 p.m. OK GNU C++17 TESTS 20 31 5120000 1700
87583633 Unpossible A2 July 21, 2020, 4:13 p.m. OK GNU C++17 TESTS 20 31 5222400 1700
87538304 cn449 A2 July 21, 2020, 2:51 p.m. OK GNU C++17 TESTS 20 31 5222400 1700
87546045 bry_rp A2 July 21, 2020, 3:02 p.m. OK GNU C++17 TESTS 20 31 5222400 1700
87563108 MaxZubec A2 July 21, 2020, 3:30 p.m. OK GNU C++17 TESTS 20 31 5222400 1700
87543243 NotaMotuaQAQ A2 July 21, 2020, 2:58 p.m. OK GNU C++17 (64) TESTS 20 30 10752000 1700
87535162 teapotd A2 July 21, 2020, 2:47 p.m. OK GNU C++17 (64) TESTS 20 31 5632000 1700
87599087 shashanka136 A2 July 21, 2020, 5:40 p.m. OK GNU C++17 (64) TESTS 20 31 5632000 1700
87569473 Mip182 A2 July 21, 2020, 3:42 p.m. OK GNU C++17 (64) TESTS 20 31 5734400 1700
87543389 Macdu A2 July 21, 2020, 2:58 p.m. OK GNU C++17 (64) TESTS 20 31 5734400 1700
87541636 Rorent A2 July 21, 2020, 2:56 p.m. OK GNU C++17 (64) TESTS 20 31 5734400 1700
87536084 BaaaaaaaaaaaaaaarkingDog A2 July 21, 2020, 2:48 p.m. OK GNU C++17 (64) TESTS 20 31 5734400 1700
87609263 FlowerOfSorrow A2 July 21, 2020, 7:27 p.m. OK GNU C++17 (64) TESTS 20 31 5734400 1700
87602118 Kuroni A2 July 21, 2020, 6:05 p.m. OK GNU C++17 (64) TESTS 20 31 5734400 1700
87614632 Prateek A2 July 21, 2020, 9:01 p.m. OK GNU C++17 (64) TESTS 20 31 6246400 1700
87610810 meooow A2 July 21, 2020, 7:50 p.m. OK Go TESTS 20 62 15667200 1700
87540684 Xylenox A2 July 21, 2020, 2:54 p.m. OK Go TESTS 20 77 16384000 1700
87559197 mphillotry A2 July 21, 2020, 3:23 p.m. OK Java 11 TESTS 20 218 23859200 1700
87539292 cirno3153 A2 July 21, 2020, 2:52 p.m. OK Java 11 TESTS 20 218 23961600 1700
87541624 uwi A2 July 21, 2020, 2:55 p.m. OK Java 11 TESTS 20 218 24166400 1700
87539505 PizzaLovers007 A2 July 21, 2020, 2:53 p.m. OK Java 11 TESTS 20 264 30310400 1700
87538922 awesomelemonade A2 July 21, 2020, 2:52 p.m. OK Java 11 TESTS 20 296 23859200 1700
87613483 jhu123 A2 July 21, 2020, 8:37 p.m. OK Java 11 TESTS 20 592 25497600 1700
87563935 Naman_123 A2 July 21, 2020, 3:32 p.m. OK Java 8 TESTS 20 124 21094400 1700
87618460 martins A2 July 21, 2020, 10:42 p.m. OK Java 8 TESTS 20 124 21606400 1700
87560215 BNL A2 July 21, 2020, 3:25 p.m. OK Java 8 TESTS 20 140 20684800 1700
87579260 barakraganosungam A2 July 21, 2020, 4:03 p.m. OK Java 8 TESTS 20 155 20480000 1700
87577941 robinz62 A2 July 21, 2020, 4 p.m. OK Java 8 TESTS 20 155 20480000 1700
87548117 mwen A2 July 21, 2020, 3:05 p.m. OK Java 8 TESTS 20 155 20480000 1700
87565465 phantom11 A2 July 21, 2020, 3:34 p.m. OK Java 8 TESTS 20 155 20684800 1700
87551849 NewtScamander A2 July 21, 2020, 3:11 p.m. OK Java 8 TESTS 20 155 20889600 1700
87550468 ijxjdjd A2 July 21, 2020, 3:09 p.m. OK Java 8 TESTS 20 155 20889600 1700
87548201 naam_me_kya_rakha_he A2 July 21, 2020, 3:05 p.m. OK Java 8 TESTS 20 155 20992000 1700
87542638 Hakiobo A2 July 21, 2020, 2:57 p.m. OK Kotlin TESTS 20 140 21094400 1700
87626102 Spheniscine A2 July 22, 2020, 2:35 a.m. OK Kotlin TESTS 20 140 22528000 1700
87534528 ekaerovets A2 July 21, 2020, 2:47 p.m. OK Kotlin TESTS 20 155 21094400 1700
87625832 Spheniscine A2 July 22, 2020, 2:29 a.m. OK Kotlin TESTS 20 155 22425600 1700
87567811 batkhuyag A2 July 21, 2020, 3:39 p.m. OK Kotlin TESTS 20 186 23961600 1700
87575298 golions A2 July 21, 2020, 3:54 p.m. OK Kotlin TESTS 20 187 23756800 1700
87529332 Tlatoani A2 July 21, 2020, 2:42 p.m. OK Kotlin TESTS 20 233 24678400 1700
87547786 mban259 A2 July 21, 2020, 3:04 p.m. OK Mono C# TESTS 20 93 18329600 1700
87544277 keymoon A2 July 21, 2020, 2:59 p.m. OK Mono C# TESTS 20 93 22118400 1700
87549797 EmK A2 July 21, 2020, 3:08 p.m. OK Mono C# TESTS 20 109 20275200 1700
87542131 Yupiteru A2 July 21, 2020, 2:56 p.m. OK Mono C# TESTS 20 109 22630400 1700
87545255 terry_u16 A2 July 21, 2020, 3:01 p.m. OK Mono C# TESTS 20 124 26009600 1700
87628178 P___ A2 July 22, 2020, 3:19 a.m. OK MS C++ 2017 TESTS 20 46 5632000 1700
87550659 Numbervan A2 July 21, 2020, 3:09 p.m. OK MS C++ 2017 TESTS 20 46 5939200 1700
87536968 Pnn1337 A2 July 21, 2020, 2:49 p.m. OK MS C++ 2017 TESTS 20 46 6246400 1700
87533747 pichulia A2 July 21, 2020, 2:46 p.m. OK MS C++ 2017 TESTS 20 61 6758400 1700
87555727 tarattata1 A2 July 21, 2020, 3:17 p.m. OK MS C++ 2017 TESTS 20 62 6144000 1700
87605567 kupriyanov A2 July 21, 2020, 6:41 p.m. OK MS C++ 2017 TESTS 20 77 6656000 1700
87539070 Gravekper A2 July 21, 2020, 2:52 p.m. OK MS C++ 2017 TESTS 20 93 6553600 1700
87540272 Baharevim A2 July 21, 2020, 2:54 p.m. OK MS C++ 2017 TESTS 20 140 4915200 1700
87545287 Friska A2 July 21, 2020, 3:01 p.m. OK MS C++ 2017 TESTS 20 140 5734400 1700
87535293 pajenegod A2 July 21, 2020, 2:47 p.m. OK PyPy 2 TESTS 20 155 35225600 1700
87547816 exoji2e A2 July 21, 2020, 3:04 p.m. OK PyPy 2 TESTS 20 233 38707200 1700
87541975 archittect A2 July 21, 2020, 2:56 p.m. OK PyPy 3 TESTS 20 249 29900800 1700
87570229 nagitaosu A2 July 21, 2020, 3:44 p.m. OK PyPy 3 TESTS 20 264 34304000 1700
87565874 throwawayatcoder A2 July 21, 2020, 3:35 p.m. OK PyPy 3 TESTS 20 265 32870400 1700
87637884 faisal_sohail A2 July 22, 2020, 5:59 a.m. OK PyPy 3 TESTS 20 280 30003200 1700
87548550 neterukun A2 July 21, 2020, 3:06 p.m. OK PyPy 3 TESTS 20 280 33587200 1700
87563299 jayantjain100 A2 July 21, 2020, 3:30 p.m. OK PyPy 3 TESTS 20 280 33894400 1700
87586383 tanon710 A2 July 21, 2020, 4:19 p.m. OK PyPy 3 TESTS 20 280 34816000 1700
87539369 asvasil A2 July 21, 2020, 2:52 p.m. OK PyPy 3 TESTS 20 296 33177600 1700
87540285 mees A2 July 21, 2020, 2:54 p.m. OK PyPy 3 TESTS 20 311 31641600 1700
87610232 KAINO_ A2 July 21, 2020, 7:42 p.m. OK PyPy 3 TESTS 20 311 33996800 1700
87559203 Hitikkumar A2 July 21, 2020, 3:23 p.m. OK Python 2 TESTS 20 264 10752000 1700
87549796 nwi A2 July 21, 2020, 3:08 p.m. OK Python 2 TESTS 20 311 17203200 1700
87606284 sudhirMTS A2 July 21, 2020, 6:49 p.m. OK Python 3 TESTS 20 296 11878400 1700
87621609 mkawa2 A2 July 22, 2020, 12:35 a.m. OK Python 3 TESTS 20 327 11980800 1700
87543419 sansen A2 July 21, 2020, 2:58 p.m. OK Rust TESTS 20 46 6553600 1700
87542727 cotton100pc A2 July 21, 2020, 2:57 p.m. OK Rust TESTS 20 46 6553600 1700
87532089 Russell_Emerine A2 July 21, 2020, 2:44 p.m. OK Rust TESTS 20 46 7987200 1700
87555007 robostac A2 July 21, 2020, 3:16 p.m. OK Rust TESTS 20 46 11980800 1700
87550820 ngtkana A2 July 21, 2020, 3:09 p.m. OK Rust TESTS 20 61 7782400 1700
87607666 sansen A2 July 21, 2020, 7:05 p.m. OK Rust TESTS 20 124 7987200 1700
87607177 sansen A2 July 21, 2020, 7 p.m. OK Rust TESTS 20 187 11673600 1700

remove filters

Back to search problems