Kotlin Heroes: Episode 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
1170 Kotlin Heroes: Episode 1 FINISHED False 9000 172769099 May 28, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 122 ) F Wheels PROGRAMMING *special binary search greedy

B"Polycarp has n wheels and a car with m slots for wheels. The initial pressure in the i -th wheel is a_i . Polycarp's goal is to take exactly m wheels among the given n wheels and equalize the pressure in them (then he can put these wheels in a car and use it for driving). In one minute he can decrease or increase the pressure in any (single) wheel by 1 . He can increase the pressure no more than k times in total because it is hard to pump up wheels. Help Polycarp and say what is the minimum number of minutes he needs to spend to equalize the pressure of at least m wheels among the given n wheels. The first line of the input contains three integers n, m and k ( 1 <= m <= n <= 2 cdot 10^5, 0 <= k <= 10^9 ) -- the number of wheels, the number of slots for wheels in a car and the number of times Polycarp can increase by 1 the pressure in a wheel. 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 pressure in the i -th wheel. Print one integer -- the minimum number of minutes Polycarp needs to spend to equalize the pressure in at least m wheels among the given n wheels. "...

Tutorials

Kotlin Heroes Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
54761761 niyaznigmatul F May 28, 2019, 4:01 p.m. OK Kotlin TESTS 51 187 102400
54758765 Petr F May 28, 2019, 3:21 p.m. OK Kotlin TESTS 51 202 13004800
54760526 300iq F May 28, 2019, 3:44 p.m. OK Kotlin TESTS 51 202 14848000
54758146 eatmore F May 28, 2019, 3:14 p.m. OK Kotlin TESTS 51 218 12390400
55610780 ReaLNero1 F June 16, 2019, 5:35 a.m. OK Kotlin TESTS 51 218 13004800
54766639 wleung_bvg F May 28, 2019, 5:26 p.m. OK Kotlin TESTS 51 218 14233600
59966097 Fortin F Sept. 3, 2019, 8:38 p.m. OK Kotlin TESTS 51 233 14131200
55232907 nhho F June 7, 2019, 6:45 a.m. OK Kotlin TESTS 51 249 14233600
59966051 Fortin F Sept. 3, 2019, 8:36 p.m. OK Kotlin TESTS 51 249 15564800
54760288 DmitryGrigorev F May 28, 2019, 3:41 p.m. OK Kotlin TESTS 51 265 16588800

remove filters

Back to search problems