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.
Problems
B'You just created a new character in your favourite role-playing game and now have to decide how to skill him. The two skill attributes to be chosen are: damage per hit and hits per second. Damage per hit is the amount of damage you deal with a single hit, while hits per second is the number of hits you can make in one second. Initially, both skill attributes are set at 0 . You have k skill points to distribute as you want; in other words, you can choose the values of the two skills so that they are positive integers with sum at most k . The tutorial of the game (the boring part you want to finish as soon as possible) consists of n monsters to be killed one after the other. The i -th monster has h_i health points, i.e., it dies after you have inflicted at least h_i damage. How can you assign the two skill attributes to minimize the time necessary to kill all the n monsters? The first line contains two integers n and k ( 1 <= q n <= q200 ,000 , 2 <= q k <= q200 ,000 ) -- the number of enemies and the number of skill points. The second line contains n integers h_i ( 1 <= q h_i <= q10^{13} ) -- the health of the i th enemy. Print two positive integers x and y ( 1 <= x, y and x+y <= k ) -- the number of skill points you want to invest in damage per hit and hits per second. If there are multiple optimal solutions, print any of them. In the first sample, there is only one monster and you have 7 skill points to distribute. If you make 3 damage per hit, you will need 5 hits to kill it. If you do 4 hits per second, you will need 1.25 seconds to beat the monster. There is no way to beat the monster faster than this. In the second sample, you will need one hit for each monster and a total time of 0.8 seconds if you distribute 4 skill points on damage per hit and the remaining 5 points on hits per second. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
253148287 |
N_z__ |
E |
March 25, 2024, 12:43 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
108 |
3588 |
8089600 |
|
|
253087094 |
PubabaOnO orzdevinwang jqdai0815 |
E |
March 24, 2024, 1:07 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
108 |
4367 |
24064000 |
|
|
253154793 |
Marco_L_T |
E |
March 25, 2024, 3:24 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
108 |
4992 |
6451200 |
|
|
253123001 |
JettyOller |
E |
March 24, 2024, 6:17 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
3415 |
1638400 |
|
|
253082067 |
sevlll777 |
E |
March 24, 2024, 12:30 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
3634 |
13926400 |
|
|
253097974 |
sevlll777 |
E |
March 24, 2024, 2:28 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
3650 |
13926400 |
|
|
253091164 |
tourist ecnerwala |
E |
March 24, 2024, 1:38 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
4196 |
402432000 |
|
|
253163634 |
ship2077 |
E |
March 25, 2024, 5:48 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
4352 |
1638400 |
|
|
253162782 |
Kevin114514 |
E |
March 25, 2024, 5:38 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
4398 |
178585600 |
|
|
253076488 |
Kevin114514 CrTsIr Atomic-Jellyfish |
E |
March 24, 2024, 11:46 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
4492 |
178585600 |
|
|
253111101 |
N_z__ |
E |
March 24, 2024, 4:19 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
4539 |
9113600 |
|
|
253076719 |
Kevin114514 CrTsIr Atomic-Jellyfish |
E |
March 24, 2024, 11:48 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
4601 |
178585600 |
|
|
253163491 |
ship2077 |
E |
March 25, 2024, 5:47 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
108 |
4617 |
3276800 |
|
|
remove filters
Back to search problems