Codeforces Round 601 (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
1254 Codeforces Round 601 (Div. 1) FINISHED False 7200 163265087 Nov. 19, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3224 ) B2 Send Boxes to Alice (Hard Version) PROGRAMMING constructive algorithms greedy math number theory ternary search two pointers 2100

B"This is the harder version of the problem. In this version, 1 <= n <= 10^6 and 0 <= q a_i <= q 10^6 . You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems Christmas is coming, and our protagonist, Bob, is preparing a spectacular present for his long-time best friend Alice. This year, he decides to prepare n boxes of chocolate, numbered from 1 to n . Initially, the i -th box contains a_i chocolate pieces. Since Bob is a typical nice guy, he will not send Alice n empty boxes. In other words, at least one of a_1, a_2, ldots, a_n is positive. Since Alice dislikes coprime sets, she will be happy only if there exists some integer k > 1 such that the number of pieces in each box is divisible by k . Note that Alice won't mind if there exists some empty boxes. Charlie, Alice's boyfriend, also is Bob's second best friend, so he decides to help Bob by rearranging the chocolate pieces. In one second, Charlie can pick up a piece in box i and put it into either box i-1 or box i+1 (if such boxes exist). Of course, he wants to help his friend as quickly as possible. Therefore, he asks you to calculate the minimum number of seconds he would need to make Alice happy. The first line contains a single integer n ( 1 <= n <= 10^6 ) -- the number of chocolate boxes. The second line contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= 10^6 ) -- the number of chocolate pieces in the i -th box. It is guaranteed that at least one of a_1, a_2, ldots, a_n is positive. If there is no way for Charlie to make Alice happy, print -1 . Otherwise, print a single integer x -- the minimum number of seconds for Charlie to help Bob make Alice happy. In the first example, Charlie can move all chocolate pieces to the second box. Each box will be divisible by 17 . In the second example, Ch"...

Tutorials

Codeforces Round #601 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
65619981 PhantasmDragon B2 Nov. 24, 2019, 5:50 a.m. OK Clang++17 Diagnostics TESTS 90 702 11468800 2100
65457910 Gassa B2 Nov. 20, 2019, 10:13 p.m. OK D TESTS 90 358 37171200 2100
65368278 Gassa B2 Nov. 19, 2019, 3:21 p.m. OK D TESTS 88 373 32870400 2100
65354422 hos.lyric B2 Nov. 19, 2019, 2:42 p.m. OK D TESTS 88 389 45670400 2100
65373692 iica B2 Nov. 19, 2019, 3:39 p.m. OK D TESTS 88 420 45772800 2100
65541156 ruban B2 Nov. 22, 2019, 3:35 p.m. OK Delphi TESTS 90 732 51609600 2100
65541196 ruban B2 Nov. 22, 2019, 3:36 p.m. OK FPC TESTS 90 483 51916800 2100
65766830 LaSWeeG B2 Nov. 26, 2019, 6:21 p.m. OK FPC TESTS 90 841 24064000 2100
65620957 PhantasmDragon B2 Nov. 24, 2019, 6:11 a.m. OK GNU C11 TESTS 90 312 8396800 2100
65468916 physics0523 B2 Nov. 21, 2019, 7:31 a.m. OK GNU C11 TESTS 90 343 33587200 2100
66500448 Rubblsh12345 B2 Dec. 8, 2019, 12:19 p.m. OK GNU C++11 TESTS 90 109 3993600 2100
65462596 BeNoble B2 Nov. 21, 2019, 3:29 a.m. OK GNU C++11 TESTS 90 171 6246400 2100
65469965 Rivaille_Ackerman B2 Nov. 21, 2019, 7:58 a.m. OK GNU C++11 TESTS 90 186 3993600 2100
65440506 zijinjun_hzj B2 Nov. 20, 2019, 2:12 p.m. OK GNU C++11 TESTS 88 187 3993600 2100
65409740 luogu_bot5 B2 Nov. 20, 2019, 3:15 a.m. OK GNU C++11 TESTS 88 187 7987200 2100
68591591 wasa855 B2 Jan. 11, 2020, 12:49 p.m. OK GNU C++11 TESTS 90 187 7987200 2100
65360901 _rqy B2 Nov. 19, 2019, 2:59 p.m. OK GNU C++11 TESTS 88 202 3788800 2100
65379615 __stdcall B2 Nov. 19, 2019, 4:03 p.m. OK GNU C++11 TESTS 88 202 3993600 2100
66484349 gjc1124646822 B2 Dec. 8, 2019, 5:27 a.m. OK GNU C++11 TESTS 90 202 11980800 2100
65902480 DWAE86 B2 Nov. 28, 2019, 9:23 a.m. OK GNU C++11 TESTS 90 202 15872000 2100
65379154 liouzhou_101 B2 Nov. 19, 2019, 4:01 p.m. OK GNU C++14 TESTS 88 233 22118400 2100
65360619 Egor B2 Nov. 19, 2019, 2:58 p.m. OK GNU C++14 TESTS 88 265 3993600 2100
65370374 gs15120 B2 Nov. 19, 2019, 3:28 p.m. OK GNU C++14 TESTS 88 280 13414400 2100
66233353 atodo B2 Dec. 3, 2019, 3:14 p.m. OK GNU C++14 TESTS 90 296 3993600 2100
65561916 praiseTheSun B2 Nov. 23, 2019, 3:29 a.m. OK GNU C++14 TESTS 90 296 7987200 2100
65384583 JamesCole B2 Nov. 19, 2019, 4:20 p.m. OK GNU C++14 TESTS 88 311 7987200 2100
65381940 buko B2 Nov. 19, 2019, 4:11 p.m. OK GNU C++14 TESTS 88 311 16691200 2100
65392314 WildWesam B2 Nov. 19, 2019, 5:52 p.m. OK GNU C++14 TESTS 88 327 7987200 2100
65564113 nysanier B2 Nov. 23, 2019, 4:58 a.m. OK GNU C++14 TESTS 90 327 12083200 2100
65392498 Rubikun B2 Nov. 19, 2019, 5:54 p.m. OK GNU C++14 TESTS 88 327 29286400 2100
65371637 BinGoo0o0o B2 Nov. 19, 2019, 3:32 p.m. OK GNU C++17 TESTS 88 202 16179200 2100
65616107 HatsuneMikuo B2 Nov. 24, 2019, 3:44 a.m. OK GNU C++17 TESTS 90 217 13721600 2100
65616003 interestingLSY B2 Nov. 24, 2019, 3:39 a.m. OK GNU C++17 TESTS 90 218 13721600 2100
66569086 SHZhang2 B2 Dec. 10, 2019, 2:33 a.m. OK GNU C++17 TESTS 90 312 12083200 2100
69565482 ST_C B2 Jan. 26, 2020, 12:16 p.m. OK GNU C++17 TESTS 90 327 12083200 2100
65361580 dreamoon_love_AA B2 Nov. 19, 2019, 3:01 p.m. OK GNU C++17 TESTS 88 327 14028800 2100
65374106 KimGongju B2 Nov. 19, 2019, 3:41 p.m. OK GNU C++17 TESTS 88 327 168345600 2100
65503772 Pankin B2 Nov. 21, 2019, 8:35 p.m. OK GNU C++17 TESTS 90 343 7987200 2100
65374205 kimden B2 Nov. 19, 2019, 3:41 p.m. OK GNU C++17 TESTS 88 343 7987200 2100
65374732 Vladik B2 Nov. 19, 2019, 3:43 p.m. OK GNU C++17 TESTS 88 343 16076800 2100
65400642 Kharouba B2 Nov. 19, 2019, 9:48 p.m. OK Java 11 TESTS 88 561 19046400 2100
65395409 uwi B2 Nov. 19, 2019, 6:53 p.m. OK Java 11 TESTS 88 764 18841600 2100
65392915 iakovlev.zakhar B2 Nov. 19, 2019, 6 p.m. OK Java 11 TESTS 88 966 38604800 2100
65372770 dalt B2 Nov. 19, 2019, 3:36 p.m. OK Java 8 TESTS 88 296 19148800 2100
65750483 aminul B2 Nov. 26, 2019, 1:52 p.m. OK Java 8 TESTS 90 343 5222400 2100
65768353 derrick20 B2 Nov. 26, 2019, 7:07 p.m. OK Java 8 TESTS 90 405 5836800 2100
67176056 Xylenox B2 Dec. 18, 2019, 7:19 p.m. OK Java 8 TESTS 90 467 44134400 2100
67176018 Xylenox B2 Dec. 18, 2019, 7:18 p.m. OK Java 8 TESTS 90 468 44134400 2100
65382725 DarLam B2 Nov. 19, 2019, 4:14 p.m. OK Java 8 TESTS 88 499 37785600 2100
65365345 fetetriste B2 Nov. 19, 2019, 3:12 p.m. OK Java 8 TESTS 88 514 37478400 2100
65450332 gouh9qn B2 Nov. 20, 2019, 5:48 p.m. OK Java 8 TESTS 90 514 37990400 2100
65435344 142 B2 Nov. 20, 2019, 1:14 p.m. OK Java 8 TESTS 88 529 56012800 2100
65372008 SergeyMelnikov B2 Nov. 19, 2019, 3:33 p.m. OK Java 8 TESTS 88 530 37478400 2100
65402074 Tlatoani B2 Nov. 19, 2019, 11:25 p.m. OK Kotlin TESTS 88 686 32051200 2100
65380632 Apsara B2 Nov. 19, 2019, 4:06 p.m. OK MS C++ TESTS 88 468 28057600 2100
65402449 tarattata1 B2 Nov. 19, 2019, 11:55 p.m. OK MS C++ TESTS 88 499 36761600 2100
65410211 r57shell B2 Nov. 20, 2019, 3:37 a.m. OK MS C++ TESTS 88 530 7987200 2100
65382716 Friska B2 Nov. 19, 2019, 4:14 p.m. OK MS C++ 2017 TESTS 88 623 9318400 2100
65367185 Madball B2 Nov. 19, 2019, 3:17 p.m. OK MS C++ 2017 TESTS 88 639 36864000 2100
65374959 pichulia B2 Nov. 19, 2019, 3:44 p.m. OK MS C++ 2017 TESTS 88 655 26521600 2100
65450756 pseuda B2 Nov. 20, 2019, 6 p.m. OK MS C++ 2017 TESTS 90 888 16281600 2100
65401878 AlexanderL B2 Nov. 19, 2019, 11:10 p.m. OK MS C++ 2017 TESTS 88 982 3993600 2100
65381864 nagiss B2 Nov. 19, 2019, 4:11 p.m. OK PyPy 3 TESTS 88 982 70553600 2100
65371320 sansen B2 Nov. 19, 2019, 3:31 p.m. OK Rust TESTS 88 467 41676800 2100

remove filters

Back to search problems