Logo
(追記) (追記ここまで)

9785번 - Damage Over Time 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB98887489.157%

문제

In many MMORPGs (Massively Multiplayer Online Role-Playing Games), damage over time (DoT) is one of the good ways for the attacker to deal damage on enemies. For example, a rogue in World of Warcraft (WoW) may apply a poison to his knife and then stab it on an enemy using “Garrote” ability. Both poison and garrote offer the damage over time. For example, poison deals 10 damages per second for 10 seconds and garrote deals 20 damages per second for 5 seconds. That is, “stacking” as many DoT as possible on enemy certainly results in great total damages.

Here is the problem. You are required to write a program, for a set of provided DoT abilities, to calculate the possible maximum DoT and the maximum length of time of such DoT to be hold. In the example above, the possible maximum DoT is 30 damages for 5 seconds.

입력

The first line of the input includes integer N (0 < N < 100) indicating the number of abilities and integer M (0 < M < 100, M ≤ N) indicating how many abilities can be “stacked up” at one time. Then, each ability is input by its damage per seconds and its length (seconds), one ability per one line.

출력

Print out the maximum DoT being possible to apply to an enemy using the provided set of abilities and the length of time such maximum DoT hold.

제한

예제 입력 1

3 2
15 10
7 3
7 2

예제 출력 1

22 3

힌트

출처

ICPC > Regionals > Asia Pacific > Thailand > Thailand Southern Programming Contest > Thailand Southern Programming Contest 2012 D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /