Damage per Second

시간 제한5초메모리 제한2048 MB

요약
n마리 몬스터의 체력과 k개의 스킬 포인트가 주어질 때, 합이 k 이하인 양의 정수 x(공격력)와 y(초당 공격 횟수)를 정해 모든 몬스터를 잡는 총 시간을 최소화한다.
난이도

보통10점 중 7점

유형
수학, 이분 탐색, 그리디
정답자
아직 제출이 없습니다

문제

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 00. You have kk 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 kk.

The tutorial of the game (the boring part you want to finish as soon as possible) consists of nn monsters to be killed one after the other. The ii-th monster has h_ih\_i health points, i.e., it dies after you have inflicted at least h_ih\_i damage.

How can you assign the two skill attributes to minimize the time necessary to kill all the nn monsters?

입력

The first line contains two integers nn and kk (1≤n≤200,0001 ≤ n ≤ 200\\, 000, 2≤k≤200,0002 ≤ k ≤ 200\\, 000) — the number of enemies and the number of skill points.

The second line contains nn integers h_ih\_i (1≤h_i≤10131 ≤ h\_i ≤ 10^{13}) — the health of the iith enemy.

출력

Print two positive integers xx and yy (1≤x,y1 ≤ x, y and x+y≤kx + 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.

예제3

  1. 예제 1

    입력
    1 7
    14
    
    예상 출력
    3 4
    
  2. 예제 2

    입력
    4 9
    1 2 3 4
    
    예상 출력
    4 5
    
  3. 예제 3

    입력
    5 13
    3 4 5 6 7
    
    예상 출력
    7 6