Bitaro the Brave 3
시간 제한2초메모리 제한2048 MB
각 기준값 M에 대해 남은 몬스터의 가중 HP 합이 M 이하가 되도록 처치할 수 있는 최대 난이도를 구한다.
문제
Bitaro, the brave hero, is about to take on the Defense Battle quest to protect the village from monsters. The difficulty of the Defense Battle is represented by an integer between and , inclusive, and this value can be chosen at the start of the challenge. In a Defense Battle of difficulty (), the HP of monsters is multiplied by compared to that at difficulty .
The Defense Battle lasts for seconds, and monsters will appear throughout the battle. Each monster is assigned a unique number from to . Time () refers to the moment seconds after the battle starts. Monster () appears at time (), has strength , and its HP at difficulty is given by .
During the Defense Battle, Bitaro can perform the following action any number of times.
- Select one of the monsters currently present and attack it, which takes second. The monster’s HP decreases by . Once a monster’s HP reaches , it is considered defeated and will no longer be attacked.
When time reaches , the Defense Battle ends, and the penalty score is computed as follows.
- Let be the HP of monster () immediately after time . The penalty score is computed as .
If the penalty score is less than or equal to a threshold value specified by the quest, Bitaro successfully completes the quest.
Since higher difficulties yield better rewards, Bitaro wants to determine the highest difficulty level at which he can complete the quest. However, the threshold value is unknown in advance. Thus, Bitaro decides to determine the highest difficulty level at which he can complete the quest for each of candidate threshold values .
Given the information about the Defense Battle and the candidate threshold values, write a program that determines whether the quest can be completed for each threshold value and, if possible, finds the maximum difficulty level at which the quest can be completed.
입력
Read the following data from the standard input.
출력
Write lines to the standard output. In the -th line (), output the maximum difficulty level at which the quest can be completed when . If the quest cannot be completed at any difficulty level, output 0 instead.
제한
- .
- .
- .
- ().
- ().
- ().
- .
- .
- ().
- .
- Given values are all integers.