atcoder#ABC203F. [ABC203F] Weed
[ABC203F] Weed
Score : points
Problem Statement
Takahashi's and Aoki's garden is covered with weeds, called Weed , Weed , , Weed . The height of Weed is . Takahashi and Aoki have decided to pull these weeds, as follows:
- First, Aoki will choose at most weeds and pull them.
- Then, Takahashi will repeat the following operation until all weeds are pulled.- Let be the height of the tallest remaining weeds. Pull all weeds with heights above at once.
Aoki wants to minimize the number of operations done by Takahashi. Also, he wants to minimize it by pulling the minimum number of weeds needed. Find the number of operations done by Takahashi and the number of weeds Aoki pulls in this case.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of operations Takahashi will do and the number of weeds Aoki will pull, in this order, with a space in between.
4 1
2 3 4 9
2 1
For example, assume that Aoki chooses Weed , with height , and pulls it. Then, the tallest remaining weed is Weed , with height . We have , and Takahashi will pull Weed and in the first operation, since and . Then, he will pull Weed in the second operation, completing his work in two operations. On the other hand, he will not complete his work in one operation, no matter which one weed Aoki chooses.
Also, if Aoki pulls no weed, Takahashi will have to do three operations, so Aoki must pull at least one weed to minimize the number of operations done by Takahashi.
3 3
2 3 5
0 3
If Aoki pulls all weeds, Takahashi has to do zero operations, which is obviously the smallest number possible.
9 8
137 55 56 60 27 28 133 56 55
1 4