Codeforces Round 671 (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
1419 Codeforces Round 671 (Div. 2) FINISHED False 7200 131297099 Sept. 19, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 15706 ) D2 Sage's Birthday (hard version) PROGRAMMING binary search constructive algorithms greedy implementation sortings two pointers

B"This is the hard version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem. Today is Sage's birthday, and she will go shopping to buy ice spheres. All n ice spheres are placed in a row and they are numbered from 1 to n from left to right. Each ice sphere has a positive integer price. In this version, some prices can be equal. An ice sphere is cheap if it costs strictly less than two neighboring ice spheres: the nearest to the left and the nearest to the right. The leftmost and the rightmost ice spheres are not cheap. Sage will choose all cheap ice spheres and then buy only them. You can visit the shop before Sage and reorder the ice spheres as you wish. Find out the maximum number of ice spheres that Sage can buy, and show how the ice spheres should be reordered. The first line contains a single integer n (1 <= n <= 10^5) -- the number of ice spheres in the shop. The second line contains n integers a_1, a_2, ... , a_n (1 <= a_i <= 10^9) -- the prices of ice spheres. In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. In the sample it's not possible to place the ice spheres in any order so that Sage would buy 4 of them. If the spheres are placed in the order (3, 1, 4, 2, 4, 2, 5) , then Sage will buy one sphere for 1 and two spheres for 2 each. "...

Tutorials

Codeforces Round #671 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
93275147 ruban D2 Sept. 19, 2020, 6:42 p.m. OK Delphi TESTS 68 140 135987200
93274967 ruban D2 Sept. 19, 2020, 6:40 p.m. OK FPC TESTS 68 405 135987200
93299538 Wenbo888 D2 Sept. 20, 2020, 4:19 a.m. OK GNU C11 TESTS 68 421 819200
93265678 asztrikx D2 Sept. 19, 2020, 4:29 p.m. OK GNU C11 TESTS 67 451 819200
93266719 -----Thor---- D2 Sept. 19, 2020, 4:31 p.m. OK GNU C11 TESTS 67 451 1638400
93290296 pocafup D2 Sept. 19, 2020, 11:43 p.m. OK GNU C++11 TESTS 68 46 819200
93297858 lzzAKIOI D2 Sept. 20, 2020, 3:46 a.m. OK GNU C++11 TESTS 68 46 1024000
93295984 QwQcOrZ D2 Sept. 20, 2020, 3:02 a.m. OK GNU C++11 TESTS 68 62 819200
93295900 cghtxdy D2 Sept. 20, 2020, 3 a.m. OK GNU C++11 TESTS 68 62 819200
93291211 pzc2004 D2 Sept. 20, 2020, 12:26 a.m. OK GNU C++11 TESTS 68 62 819200
93291205 onglu1 D2 Sept. 20, 2020, 12:26 a.m. OK GNU C++11 TESTS 68 62 819200
93295712 SSerxhs D2 Sept. 20, 2020, 2:55 a.m. OK GNU C++11 TESTS 68 62 921600
93266721 wuruzhao D2 Sept. 19, 2020, 4:31 p.m. OK GNU C++11 TESTS 67 62 1228800
93289340 Daniel_Jiang D2 Sept. 19, 2020, 10:58 p.m. OK GNU C++11 TESTS 68 62 1638400
93297449 AyoAyowei D2 Sept. 20, 2020, 3:38 a.m. OK GNU C++11 TESTS 68 62 1843200
93277076 bizarre D2 Sept. 19, 2020, 6:57 p.m. OK GNU C++14 TESTS 68 77 409600
93302447 omhari D2 Sept. 20, 2020, 5:15 a.m. OK GNU C++14 TESTS 68 77 819200
93277426 hoangle134134134 D2 Sept. 19, 2020, 7:01 p.m. OK GNU C++14 TESTS 68 77 819200
93274360 SJ333 D2 Sept. 19, 2020, 6:36 p.m. OK GNU C++14 TESTS 68 77 819200
93266160 stostap D2 Sept. 19, 2020, 4:30 p.m. OK GNU C++14 TESTS 67 77 819200
93300920 nandonathaniel D2 Sept. 20, 2020, 4:48 a.m. OK GNU C++14 TESTS 68 77 1024000
93298703 atharmohd D2 Sept. 20, 2020, 4:03 a.m. OK GNU C++14 TESTS 68 77 1024000
93284391 _BadLoser D2 Sept. 19, 2020, 8:41 p.m. OK GNU C++14 TESTS 68 77 1024000
93272544 stefdasca D2 Sept. 19, 2020, 6:27 p.m. OK GNU C++14 TESTS 67 77 1126400
93268515 Omar_Elaraby D2 Sept. 19, 2020, 4:34 p.m. OK GNU C++14 TESTS 67 77 1228800
93290019 ygy D2 Sept. 19, 2020, 11:31 p.m. OK GNU C++17 TESTS 68 61 2252800
93293053 LayCurse D2 Sept. 20, 2020, 1:40 a.m. OK GNU C++17 TESTS 68 61 100864000
93298339 gabrielwu D2 Sept. 20, 2020, 3:56 a.m. OK GNU C++17 TESTS 68 77 819200
93294187 Convergence D2 Sept. 20, 2020, 2:14 a.m. OK GNU C++17 TESTS 68 77 819200
93291592 a_natural D2 Sept. 20, 2020, 12:45 a.m. OK GNU C++17 TESTS 68 77 819200
93286361 hoshyarchand D2 Sept. 19, 2020, 9:26 p.m. OK GNU C++17 TESTS 68 77 819200
93285976 kakashi. D2 Sept. 19, 2020, 9:18 p.m. OK GNU C++17 TESTS 68 77 819200
93280909 b_ritish D2 Sept. 19, 2020, 7:41 p.m. OK GNU C++17 TESTS 68 77 819200
93280344 training_2001 D2 Sept. 19, 2020, 7:34 p.m. OK GNU C++17 TESTS 68 77 819200
93276351 p4lacios D2 Sept. 19, 2020, 6:51 p.m. OK GNU C++17 TESTS 68 77 819200
93304425 axat0081 D2 Sept. 20, 2020, 5:47 a.m. OK GNU C++17 (64) TESTS 68 46 5017600
93303309 bubu2006 D2 Sept. 20, 2020, 5:30 a.m. OK GNU C++17 (64) TESTS 68 62 819200
93302778 _sad_ D2 Sept. 20, 2020, 5:21 a.m. OK GNU C++17 (64) TESTS 68 62 819200
93297031 olphe D2 Sept. 20, 2020, 3:29 a.m. OK GNU C++17 (64) TESTS 68 62 819200
93293268 forceac D2 Sept. 20, 2020, 1:46 a.m. OK GNU C++17 (64) TESTS 68 62 819200
93290025 BeAsTmAsTeR D2 Sept. 19, 2020, 11:31 p.m. OK GNU C++17 (64) TESTS 68 62 819200
93283048 3RB D2 Sept. 19, 2020, 8:15 p.m. OK GNU C++17 (64) TESTS 68 62 819200
93278812 rifatrraazz D2 Sept. 19, 2020, 7:15 p.m. OK GNU C++17 (64) TESTS 68 62 819200
93278060 NinevskiyKN D2 Sept. 19, 2020, 7:07 p.m. OK GNU C++17 (64) TESTS 68 62 819200
93272435 lsantire D2 Sept. 19, 2020, 6:27 p.m. OK GNU C++17 (64) TESTS 67 62 819200
93286073 clyring D2 Sept. 19, 2020, 9:20 p.m. OK Haskell TESTS 68 514 26316800
93265166 akman10 D2 Sept. 19, 2020, 4:28 p.m. OK Java 11 TESTS 67 249 0
93291014 nadaabdo588 D2 Sept. 20, 2020, 12:17 a.m. OK Java 11 TESTS 68 249 0
93266733 ostin D2 Sept. 19, 2020, 4:31 p.m. OK Java 11 TESTS 67 249 0
93266243 Ste D2 Sept. 19, 2020, 4:30 p.m. OK Java 11 TESTS 67 249 0
93299336 sf14t D2 Sept. 20, 2020, 4:16 a.m. OK Java 11 TESTS 68 264 0
93275974 DreamInfinite D2 Sept. 19, 2020, 6:48 p.m. OK Java 11 TESTS 68 264 0
93275243 saikaushik D2 Sept. 19, 2020, 6:42 p.m. OK Java 11 TESTS 68 265 0
93272081 vineet_001 D2 Sept. 19, 2020, 6:26 p.m. OK Java 11 TESTS 67 265 0
93275408 m0nk3y_d_luffy D2 Sept. 19, 2020, 6:43 p.m. OK Java 11 TESTS 68 280 0
93266164 Drake1208 D2 Sept. 19, 2020, 4:30 p.m. OK Java 11 TESTS 67 280 3072000
93273288 ragnarok001 D2 Sept. 19, 2020, 6:30 p.m. OK Java 8 TESTS 68 155 0
93277906 MubtasimShahriar D2 Sept. 19, 2020, 7:06 p.m. OK Java 8 TESTS 68 155 0
93278311 nandit D2 Sept. 19, 2020, 7:10 p.m. OK Java 8 TESTS 68 156 0
93273524 revanthreddy85 D2 Sept. 19, 2020, 6:32 p.m. OK Java 8 TESTS 68 171 0
93272947 sourav2999 D2 Sept. 19, 2020, 6:29 p.m. OK Java 8 TESTS 68 171 0
93267514 sizzula D2 Sept. 19, 2020, 4:32 p.m. OK Java 8 TESTS 67 186 0
93296947 kamal_20 D2 Sept. 20, 2020, 3:27 a.m. OK Java 8 TESTS 68 186 0
93280149 maanit_s D2 Sept. 19, 2020, 7:32 p.m. OK Java 8 TESTS 68 187 0
93288568 Naman_123 D2 Sept. 19, 2020, 10:27 p.m. OK Java 8 TESTS 68 187 0
93295072 ZerooCool D2 Sept. 20, 2020, 2:38 a.m. OK Java 8 TESTS 68 202 0
93302336 Spheniscine D2 Sept. 20, 2020, 5:13 a.m. OK Kotlin TESTS 68 202 1638400
93272579 koboshi D2 Sept. 19, 2020, 6:28 p.m. OK Kotlin TESTS 68 249 2867200
93283287 koper D2 Sept. 19, 2020, 8:20 p.m. OK Kotlin TESTS 68 311 10240000
93266133 sergmel D2 Sept. 19, 2020, 4:30 p.m. OK Kotlin TESTS 67 358 9523200
93276947 Sasha1 D2 Sept. 19, 2020, 6:56 p.m. OK Mono C# TESTS 68 421 19660800
93293319 Educated_GUCCI D2 Sept. 20, 2020, 1:47 a.m. OK MS C++ 2017 TESTS 68 93 819200
93291283 dundae D2 Sept. 20, 2020, 12:29 a.m. OK MS C++ 2017 TESTS 68 93 1638400
93268588 3funnn D2 Sept. 19, 2020, 4:34 p.m. OK MS C++ 2017 TESTS 67 187 1228800
93285257 TheSherlockHomie D2 Sept. 19, 2020, 9:03 p.m. OK MS C++ 2017 TESTS 68 187 1638400
93264757 Rouzhs D2 Sept. 19, 2020, 4:27 p.m. OK MS C++ 2017 TESTS 67 187 1945600
93286478 Awa149 D2 Sept. 19, 2020, 9:29 p.m. OK MS C++ 2017 TESTS 68 187 2150400
93281888 Myao D2 Sept. 19, 2020, 7:56 p.m. OK MS C++ 2017 TESTS 68 202 1638400
93280073 Extraordinary_ D2 Sept. 19, 2020, 7:30 p.m. OK MS C++ 2017 TESTS 68 217 5427200
93291609 terry_u16 D2 Sept. 20, 2020, 12:45 a.m. OK .NET Core C# TESTS 68 140 10752000
93292658 terry_u16 D2 Sept. 20, 2020, 1:27 a.m. OK .NET Core C# TESTS 68 140 10752000
93290497 terry_u16 D2 Sept. 19, 2020, 11:51 p.m. OK .NET Core C# TESTS 68 140 12800000
93273012 hajab D2 Sept. 19, 2020, 6:29 p.m. OK PyPy 2 TESTS 68 171 11776000
93286793 chaudhary_19 D2 Sept. 19, 2020, 9:37 p.m. OK PyPy 2 TESTS 68 202 13004800
93274034 Akhil_Rautela D2 Sept. 19, 2020, 6:34 p.m. OK PyPy 3 TESTS 68 218 11161600
93282540 manish.17 D2 Sept. 19, 2020, 8:07 p.m. OK PyPy 3 TESTS 68 218 11980800
93273922 2019ucp1350 D2 Sept. 19, 2020, 6:34 p.m. OK PyPy 3 TESTS 68 249 13209600
93279386 shadoX D2 Sept. 19, 2020, 7:22 p.m. OK PyPy 3 TESTS 68 280 12390400
93278905 shadoX D2 Sept. 19, 2020, 7:16 p.m. OK PyPy 3 TESTS 68 296 12288000
93265924 faking_legend D2 Sept. 19, 2020, 4:30 p.m. OK PyPy 3 TESTS 67 311 11059200
93278954 shadoX D2 Sept. 19, 2020, 7:17 p.m. OK PyPy 3 TESTS 68 312 12185600
93291396 8wings D2 Sept. 20, 2020, 12:35 a.m. OK PyPy 3 TESTS 68 327 16896000
93304357 indra_adhikary D2 Sept. 20, 2020, 5:46 a.m. OK PyPy 3 TESTS 68 342 13824000
93272605 rishi_saraswat D2 Sept. 19, 2020, 6:28 p.m. OK PyPy 3 TESTS 68 342 16281600
93266190 CostumeParty D2 Sept. 19, 2020, 4:30 p.m. OK Python 3 TESTS 67 311 9830400
93297591 _DON_ D2 Sept. 20, 2020, 3:41 a.m. OK Python 3 TESTS 68 327 8499200
93276933 sh1194 D2 Sept. 19, 2020, 6:56 p.m. OK Python 3 TESTS 68 327 8499200
93268883 nguyenmphu D2 Sept. 19, 2020, 4:34 p.m. OK Python 3 TESTS 67 327 8499200
93298959 vignesh_Vel D2 Sept. 20, 2020, 4:08 a.m. OK Python 3 TESTS 68 342 8499200
93291665 samars_diary D2 Sept. 20, 2020, 12:48 a.m. OK Python 3 TESTS 68 343 8499200
93278735 301_anky D2 Sept. 19, 2020, 7:14 p.m. OK Python 3 TESTS 68 358 8499200
93277132 Gausstein D2 Sept. 19, 2020, 6:58 p.m. OK Python 3 TESTS 68 358 8499200
93280476 abhinay007 D2 Sept. 19, 2020, 7:36 p.m. OK Python 3 TESTS 68 374 8499200
93281586 aakarsh D2 Sept. 19, 2020, 7:52 p.m. OK Python 3 TESTS 68 374 8499200
93268298 bor.is D2 Sept. 19, 2020, 4:34 p.m. OK Rust TESTS 67 93 6553600

remove filters

Back to search problems