Codeforces Round 540 (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
1118 Codeforces Round 540 (Div. 3) FINISHED False 8100 186938723 Feb. 19, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6397 ) D2 Coffee and Coursework (Hard Version) PROGRAMMING binary search greedy 1900

B"The only difference between easy and hard versions is the constraints. Polycarp has to write a coursework. The coursework consists of m pages. Polycarp also has n cups of coffee. The coffee in the i -th cup Polycarp has a_i caffeine in it. Polycarp can drink some cups of coffee (each one no more than once). He can drink cups in any order. Polycarp drinks each cup instantly and completely (i.e. he cannot split any cup into several days). Surely, courseworks are not being written in a single day (in a perfect world of Berland, at least). Let's consider some day of Polycarp's work. Consider Polycarp drinks k cups of coffee during this day and caffeine dosages of cups Polycarp drink during this day are a_{i_1}, a_{i_2}, ... , a_{i_k} . Then the first cup he drinks gives him energy to write a_{i_1} pages of coursework, the second cup gives him energy to write max(0, a_{i_2} - 1) pages, the third cup gives him energy to write max(0, a_{i_3} - 2) pages, ..., the k -th cup gives him energy to write max(0, a_{i_k} - k + 1) pages. If Polycarp doesn't drink coffee during some day, he cannot write coursework at all that day. Polycarp has to finish his coursework as soon as possible (spend the minimum number of days to do it). Your task is to find out this number of days or say that it is impossible. The first line of the input contains two integers n and m ( 1 <= n <= 2 cdot 10^5 , 1 <= m <= 10^9 ) -- the number of cups of coffee and the number of pages in the coursework. The second line of the input contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ), where a_i is the caffeine dosage of coffee in the i -th cup. If it is impossible to write the coursework, print -1. Otherwise print the minimum number of days Polycarp needs to do it. In the first example Polycarp can drink fourth cup during first day (and write 1 page), first and secon"...

Tutorials

65396

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
50301682 Yasola D2 Feb. 22, 2019, 2:47 a.m. OK Clang++17 Diagnostics TESTS 49 311 0 1900
67524615 vjudge5 D2 Dec. 24, 2019, 1:35 p.m. OK Clang++17 Diagnostics TESTS 50 1201 1024000 1900
50229545 Pashechka D2 Feb. 20, 2019, 8:37 a.m. OK Clang++17 Diagnostics TESTS 49 1309 9932800 1900
51146610 kmachina D2 March 11, 2019, 1:25 a.m. OK Clang++17 Diagnostics TESTS 50 1341 1126400 1900
51146515 kmachina D2 March 11, 2019, 1:16 a.m. OK Clang++17 Diagnostics TESTS 50 1356 1126400 1900
51146500 kmachina D2 March 11, 2019, 1:14 a.m. OK Clang++17 Diagnostics TESTS 50 1372 1126400 1900
51126862 kmachina D2 March 10, 2019, 12:01 p.m. OK Clang++17 Diagnostics TESTS 50 1388 1126400 1900
51128425 kmachina D2 March 10, 2019, 12:43 p.m. OK Clang++17 Diagnostics TESTS 50 1404 1126400 1900
50195514 ia7ck D2 Feb. 19, 2019, 4:37 p.m. OK D TESTS 49 109 11571200 1900
51680141 rr_ D2 March 22, 2019, 12:18 p.m. OK D TESTS 50 124 11571200 1900
54534912 Denor D2 May 23, 2019, 7:22 p.m. OK Delphi TESTS 50 93 1740800 1900
50569719 PhuongPeu D2 Feb. 27, 2019, 2:47 p.m. OK FPC TESTS 50 93 921600 1900
50495562 DarkAvengerr D2 Feb. 25, 2019, 3 p.m. OK FPC TESTS 50 109 1638400 1900
51289251 chaorenhaha D2 March 14, 2019, 9:12 a.m. OK FPC TESTS 50 124 3174400 1900
50720470 xiezichen D2 March 3, 2019, 8:27 a.m. OK GNU C++11 TESTS 50 46 614400 1900
55198454 Umi D2 June 6, 2019, 9:32 a.m. OK GNU C++11 TESTS 50 46 819200 1900
50273188 Scut82 D2 Feb. 21, 2019, 8:27 a.m. OK GNU C++11 TESTS 49 46 819200 1900
50273168 Scut82 D2 Feb. 21, 2019, 8:27 a.m. OK GNU C++11 TESTS 49 46 819200 1900
50264362 zylbeyondlimits D2 Feb. 21, 2019, 3:31 a.m. OK GNU C++11 TESTS 49 46 819200 1900
50237660 ymz D2 Feb. 20, 2019, 11:33 a.m. OK GNU C++11 TESTS 49 46 819200 1900
50228241 cXs5 D2 Feb. 20, 2019, 8 a.m. OK GNU C++11 TESTS 49 46 819200 1900
50224024 Cenjougaharx D2 Feb. 20, 2019, 6:29 a.m. OK GNU C++11 TESTS 49 46 819200 1900
50281913 Mr_Wu D2 Feb. 21, 2019, 1:05 p.m. OK GNU C++11 TESTS 49 46 1433600 1900
50283902 UESTC_Forsaken D2 Feb. 21, 2019, 1:58 p.m. OK GNU C++11 TESTS 49 46 1638400 1900
50628630 interestingLSY D2 March 1, 2019, 7:44 a.m. OK GNU C++14 TESTS 50 46 2662400 1900
50239901 tokitsukaze D2 Feb. 20, 2019, 12:30 p.m. OK GNU C++14 TESTS 49 61 3276800 1900
50272856 hank55663 D2 Feb. 21, 2019, 8:17 a.m. OK GNU C++14 TESTS 49 62 819200 1900
50234245 ziyi D2 Feb. 20, 2019, 9:58 a.m. OK GNU C++14 TESTS 49 62 819200 1900
50426542 vjudge3 D2 Feb. 24, 2019, 11:50 a.m. OK GNU C++14 TESTS 50 62 7987200 1900
53493998 IsaacMoris D2 April 29, 2019, 10:39 a.m. OK GNU C++14 TESTS 50 77 819200 1900
66679804 ForeverBrick D2 Dec. 12, 2019, 12:41 p.m. OK GNU C++14 TESTS 50 77 819200 1900
64181644 Ramprosad D2 Nov. 4, 2019, 1:21 a.m. OK GNU C++14 TESTS 50 77 819200 1900
52631576 Bencq D2 April 12, 2019, 7:24 a.m. OK GNU C++14 TESTS 50 77 819200 1900
50594874 _dne D2 Feb. 28, 2019, 9:34 a.m. OK GNU C++14 TESTS 50 77 819200 1900
50703240 .tx D2 March 3, 2019, 12:50 a.m. OK GNU C++17 TESTS 50 46 819200 1900
51597685 kessido D2 March 20, 2019, 11:58 p.m. OK GNU C++17 TESTS 50 62 819200 1900
50238547 Jiew D2 Feb. 20, 2019, 11:56 a.m. OK GNU C++17 TESTS 49 62 819200 1900
50209579 AhmedKhaledS D2 Feb. 19, 2019, 9:50 p.m. OK GNU C++17 TESTS 49 62 819200 1900
50203435 gaelim D2 Feb. 19, 2019, 6:07 p.m. OK GNU C++17 TESTS 49 62 819200 1900
50671676 BambooCertain D2 March 2, 2019, 7:19 a.m. OK GNU C++17 TESTS 50 62 7987200 1900
51917889 sammochen D2 March 28, 2019, 12:38 a.m. OK GNU C++17 TESTS 50 77 819200 1900
50590945 Artemx D2 Feb. 28, 2019, 7:24 a.m. OK GNU C++17 TESTS 50 77 819200 1900
50414257 jonathansilver D2 Feb. 24, 2019, 5:32 a.m. OK GNU C++17 TESTS 50 77 819200 1900
50238593 Jiew D2 Feb. 20, 2019, 11:57 a.m. OK GNU C++17 TESTS 49 77 819200 1900
50214685 2008061626 D2 Feb. 20, 2019, 3:29 a.m. OK Go TESTS 49 233 5222400 1900
50254649 typedef_2000 D2 Feb. 20, 2019, 6:59 p.m. OK Java 8 TESTS 49 140 0 1900
61348381 vaibhav28 D2 Sept. 27, 2019, 6:37 a.m. OK Java 8 TESTS 50 140 0 1900
51556827 tyuan73 D2 March 20, 2019, 5:30 a.m. OK Java 8 TESTS 50 140 0 1900
50288113 dyhu083 D2 Feb. 21, 2019, 3:58 p.m. OK Java 8 TESTS 49 140 0 1900
50214801 aman28rwt D2 Feb. 20, 2019, 3:35 a.m. OK Java 8 TESTS 49 140 0 1900
50198034 iamyashh D2 Feb. 19, 2019, 4:48 p.m. OK Java 8 TESTS 49 140 0 1900
57150632 Shivam_72 D2 July 16, 2019, 2:38 p.m. OK Java 8 TESTS 50 155 0 1900
50290320 revanthreddy85 D2 Feb. 21, 2019, 5:05 p.m. OK Java 8 TESTS 49 155 0 1900
50233635 Anonymous D2 Feb. 20, 2019, 9:43 a.m. OK Java 8 TESTS 49 155 0 1900
50200662 bazinga84 D2 Feb. 19, 2019, 5:12 p.m. OK Java 8 TESTS 49 155 0 1900
50193712 LLI_E_P_JI_O_K D2 Feb. 19, 2019, 4:28 p.m. OK JavaScript TESTS 49 217 35430400 1900
50627918 exs D2 March 1, 2019, 7:17 a.m. OK Kotlin TESTS 50 233 7782400 1900
50330034 kokokochet D2 Feb. 22, 2019, 6:10 p.m. OK Kotlin TESTS 49 280 19660800 1900
50319746 Killer45 D2 Feb. 22, 2019, 1:56 p.m. OK Kotlin TESTS 49 452 12492800 1900
50194230 a11eca D2 Feb. 19, 2019, 4:30 p.m. OK Kotlin TESTS 49 624 1126400 1900
51840611 Mosyagin D2 March 25, 2019, 9:26 p.m. OK Mono C# TESTS 50 140 23449600 1900
50225468 fr0st D2 Feb. 20, 2019, 7:09 a.m. OK Mono C# TESTS 49 187 36249600 1900
50305168 NEvOl D2 Feb. 22, 2019, 5:40 a.m. OK Mono C# TESTS 49 202 29388800 1900
59898466 vjudge1 D2 Sept. 2, 2019, 12:54 p.m. OK MS C++ TESTS 50 77 819200 1900
54329407 scorpiowf D2 May 18, 2019, 4:59 a.m. OK MS C++ TESTS 50 77 819200 1900
50286235 vjudge3 D2 Feb. 21, 2019, 3 p.m. OK MS C++ TESTS 49 77 819200 1900
50589194 vjudge1 D2 Feb. 28, 2019, 6:20 a.m. OK MS C++ TESTS 50 77 3276800 1900
50679303 vjudge3 D2 March 2, 2019, 10:47 a.m. OK MS C++ TESTS 50 77 16076800 1900
50679159 vjudge2 D2 March 2, 2019, 10:44 a.m. OK MS C++ TESTS 50 78 819200 1900
50387870 vjudge4 D2 Feb. 23, 2019, 1:05 p.m. OK MS C++ TESTS 50 78 819200 1900
51030158 vjudge3 D2 March 8, 2019, 1:26 p.m. OK MS C++ TESTS 50 78 819200 1900
67410611 vjudge1 D2 Dec. 22, 2019, 8:12 a.m. OK MS C++ TESTS 50 78 819200 1900
50693050 vjudge2 D2 March 2, 2019, 4:36 p.m. OK MS C++ TESTS 50 78 819200 1900
50663346 OICoder_zsx D2 March 2, 2019, 1:49 a.m. OK MS C++ 2017 TESTS 50 93 819200 1900
50429405 oceanlin D2 Feb. 24, 2019, 1:15 p.m. OK MS C++ 2017 TESTS 50 93 819200 1900
50200653 zzysleep D2 Feb. 19, 2019, 5:12 p.m. OK MS C++ 2017 TESTS 49 93 1638400 1900
50668910 yp0413170331 D2 March 2, 2019, 6 a.m. OK MS C++ 2017 TESTS 50 109 2048000 1900
50689556 rabbit11 D2 March 2, 2019, 3:03 p.m. OK MS C++ 2017 TESTS 50 124 819200 1900
57986276 pmitkov D2 July 30, 2019, 11:30 a.m. OK MS C++ 2017 TESTS 50 124 1638400 1900
52264306 zstuycz D2 April 3, 2019, 10:40 a.m. OK MS C++ 2017 TESTS 50 124 7987200 1900
52346474 zhaolonga D2 April 5, 2019, 12:52 p.m. OK MS C++ 2017 TESTS 50 139 80179200 1900
50323517 Mint_Dentifrice D2 Feb. 22, 2019, 3:31 p.m. OK MS C++ 2017 TESTS 49 186 1638400 1900
50505681 Husne_Matar D2 Feb. 25, 2019, 7:35 p.m. OK MS C++ 2017 TESTS 50 202 819200 1900
50560304 Stanislav666 D2 Feb. 27, 2019, 10:36 a.m. OK PascalABC.NET TESTS 50 545 0 1900
50208105 gatsko D2 Feb. 19, 2019, 8:33 p.m. OK PyPy 2 TESTS 49 248 14336000 1900
63032982 YESMAths D2 Oct. 20, 2019, 7:18 p.m. OK PyPy 2 TESTS 50 265 15872000 1900
50200267 Pratik_2106 D2 Feb. 19, 2019, 5:07 p.m. OK PyPy 2 TESTS 49 296 13619200 1900
57117762 IngaleAnkur10 D2 July 15, 2019, 9:33 p.m. OK PyPy 2 TESTS 50 296 13721600 1900
51317700 c1729 D2 March 15, 2019, 2:39 a.m. OK PyPy 2 TESTS 50 296 14540800 1900
50203707 aeternalis1 D2 Feb. 19, 2019, 6:14 p.m. OK PyPy 2 TESTS 49 311 13516800 1900
51317647 c1729 D2 March 15, 2019, 2:34 a.m. OK PyPy 2 TESTS 50 311 14540800 1900
50204926 c1729 D2 Feb. 19, 2019, 6:47 p.m. OK PyPy 2 TESTS 49 343 17305600 1900
51317604 c1729 D2 March 15, 2019, 2:32 a.m. OK PyPy 2 TESTS 50 358 14540800 1900
50271263 apoorv1999 D2 Feb. 21, 2019, 7:24 a.m. OK PyPy 2 TESTS 49 389 15462400 1900
50244316 nikeshthapa255 D2 Feb. 20, 2019, 2:13 p.m. OK PyPy 3 TESTS 49 311 17305600 1900
50201888 nobe0716 D2 Feb. 19, 2019, 5:34 p.m. OK PyPy 3 TESTS 49 311 17305600 1900
50196176 erd1 D2 Feb. 19, 2019, 4:40 p.m. OK PyPy 3 TESTS 49 326 17305600 1900
50282803 Evil__Coder D2 Feb. 21, 2019, 1:29 p.m. OK PyPy 3 TESTS 49 327 17305600 1900
57111152 brosucks D2 July 15, 2019, 5:29 p.m. OK PyPy 3 TESTS 50 373 16588800 1900
50260874 hmnid D2 Feb. 21, 2019, 12:27 a.m. OK PyPy 3 TESTS 49 374 16896000 1900
50432276 Regius D2 Feb. 24, 2019, 2:42 p.m. OK PyPy 3 TESTS 50 374 17305600 1900
50597835 III_Wolverine_III D2 Feb. 28, 2019, 11:18 a.m. OK PyPy 3 TESTS 50 389 17408000 1900
50229572 adshin21 D2 Feb. 20, 2019, 8:37 a.m. OK PyPy 3 TESTS 49 389 17612800 1900
50470264 yfo D2 Feb. 24, 2019, 11:33 p.m. OK PyPy 3 TESTS 50 389 18329600 1900
50217637 sampsonguo302 D2 Feb. 20, 2019, 5:43 a.m. OK Python 2 TESTS 49 982 10956800 1900
51617478 allonsy_kim D2 March 21, 2019, 1 p.m. OK Python 2 TESTS 50 1184 10854400 1900
50198104 noob_coder_v2 D2 Feb. 19, 2019, 4:48 p.m. OK Python 2 TESTS 49 1263 10956800 1900
50299472 renjied D2 Feb. 22, 2019, 12:43 a.m. OK Python 2 TESTS 49 1902 11878400 1900
50228696 zelendanny D2 Feb. 20, 2019, 8:12 a.m. OK Python 3 TESTS 49 1201 16076800 1900
50273200 soony D2 Feb. 21, 2019, 8:28 a.m. OK Python 3 TESTS 49 1263 34508800 1900
50223758 zaytpotter D2 Feb. 20, 2019, 6:22 a.m. OK Python 3 TESTS 49 1590 15974400 1900
50204955 ninoa D2 Feb. 19, 2019, 6:48 p.m. OK Python 3 TESTS 49 1653 16179200 1900
50206180 ken D2 Feb. 19, 2019, 7:25 p.m. OK Python 3 TESTS 49 1684 16076800 1900
58904118 tushartyagi8750 D2 Aug. 16, 2019, 10:19 a.m. OK Python 3 TESTS 50 1746 15667200 1900
52994471 MitI_7 D2 April 19, 2019, 2:30 a.m. OK Python 3 TESTS 50 1747 16998400 1900
51552228 Tauzn D2 March 20, 2019, 1:49 a.m. OK Python 3 TESTS 50 1778 14028800 1900
50233042 galim665 D2 Feb. 20, 2019, 9:28 a.m. OK Python 3 TESTS 49 1778 16076800 1900
56502796 codershuvo D2 July 4, 2019, 7:06 a.m. OK Python 3 TESTS 50 1793 15667200 1900
68150118 gearjack D2 Jan. 4, 2020, 6:33 a.m. OK Rust TESTS 50 77 4505600 1900
50246063 macho_uno D2 Feb. 20, 2019, 2:58 p.m. OK Rust TESTS 49 78 5734400 1900
50284320 yakamoto D2 Feb. 21, 2019, 2:09 p.m. OK Scala TESTS 49 467 0 1900

remove filters

Back to search problems