#P6300. 悔改
悔改
Problem Description
Daniel13265 has some small wooden sticks of the same original length. He randomly cuts each stick into two parts, making sure that the length of each part does not exceed .
Now he wants to connect the small sticks back to their original form, but he has lost some of the sticks, and he also forgot how many sticks he had at the beginning and what their original length was. So he plans to use the remaining small sticks to connect and form as many sticks of the same length as possible.
Given the length of each remaining small stick segment, find (1) the maximum number of equal-length sticks that can be formed from the remaining segments, and (2) the minimum possible stick length when this maximum number is achieved.
Input Format
The input consists of lines.
The first line contains two positive integers , representing the number of remaining stick segments and the maximum possible length of a remaining segment.
The second line contains positive integers separated by single spaces. The -th integer represents the length of the -th segment.
Output Format
Output one line with two integers: the maximum number of equal-length sticks that can be formed from the remaining segments, and the minimum possible stick length when this maximum is achieved.
7 10
1 1 2 4 7 8 9
2 9
Hint
Sample Explanation
To form as many sticks of length as possible, you can connect the segments of lengths and , and connect the segments of lengths and . However, if you connect the segments of lengths and , and connect the segments of lengths and , you can form sticks of length .
It can be seen that the maximum number of equal-length sticks that can be formed is . In this case, the stick length could be , , or , and the smallest is .
Constraints
This problem uses bundled subtasks. You will get the full score of a subtask only if you pass all test points in that subtask.
| Subtask ID | Score | ||
|---|---|---|---|
For of the testdata, and .
Translated by ChatGPT 5