#P8357. 「WHOI-1」Derives
「WHOI-1」Derives
Background
One counterfeit coin has been mixed into your money.
Problem Description
You have coins. After accurate measurement, you find that there must be exactly one counterfeit coin, and its mass is different from the other coins. You want to find this counterfeit coin.
In round , suppose you currently have coins. You will divide all the coins into several groups, with coins in each group, and put the remaining coins (if any) into one additional group. Picking up each coin takes seconds, so this will take seconds. Next, you will weigh each group. Weighing one group takes seconds, so this will take seconds. Since there is only one counterfeit coin, only one group will have a mass different from the normal mass. After weighing all groups, you will select the group whose mass is different from the normal mass and enter the next round, letting . You keep doing this until . Suppose there are rounds in total, then the total time is
$$f=\sum\limits_{i=1}^{m}{\left(ax_i+b\cdot\left\lceil\frac{x_i}{k_i}\right\rceil\right)}.$$In the worst case (that is, in every round the abnormal group is always a group of coins), what is the minimum time needed to find the counterfeit coin?
Input Format
One line with three positive integers, representing .
Output Format
The first line contains two non-negative integers , representing the minimum possible time and the number of rounds in your plan.
The next line contains positive integers, representing .
20 1 3
51 2
4 1
1000 10 100
13570 4
72 12 3 1
Hint
Explanation
You should try your best to make the total time as small as possible.
This problem uses Special Judge.
First, the answer you output must be valid, i.e. your output must match the selection method described above, otherwise you will get points.
Then, the judge will evaluate your output. If your output is valid and its difference from the correct answer is , you will get a score of . For example, if the difference between your output and the correct answer is , you will get . If your output equals the correct answer, you will get . Please do not output extra numbers or output fewer numbers than required.
Constraints
- .
- .
- .
- .
For all testdata, .
Sample Explanation
For the first sample, there are two rounds. . The answer is .
Translated by ChatGPT 5