#B3889. Assessment Score Reconstruction
Assessment Score Reconstruction
Assessment Score Reconstruction
In this problem, there are (n) assessment problems with a total of (10^7) points. In particular, each problem carries a base score of (\frac{10^7}{n}). For each problem, the judge (Blue) assigns one of the following scores:
- Full score: the problem is solved completely correctly and the contestant gets \(\frac{10^7}{n}\) points. However, among all problems with full score there is a subset in which the contestant performed exceptionally well, and an extra bonus of \(1\) point is added to each of those problems.
- Half score: the contestant gets \(\frac{10^7}{2n}\) points.
- No score: the contestant gets \(0\) points.
Since the score on each problem may be a fractional number, after summing up the scores (including bonus points) Blue takes the floor of the total to obtain the final score.
After completing the assessment, Blue reveals two numbers:
- \(m\): the number of problems that did not achieve full score.
- \(s\): the final total score after adding bonus points and taking the floor.
Knowing that there are exactly (n) problems in total, let
- \(a\): the number of problems with full score without bonus.
- \(b\): the number of problems with full score with bonus.
- \(c\): the number of problems with half score.
- \(d\): the number of problems with zero score.
We have the following constraints:
[ \begin{aligned} &a+b = n-m, \ &c+d = m, \ &\text{Each full-score problem gives (\frac{10^7}{n}) points, while those with bonus give an extra (1) point,}\ &\text{and each half-score problem gives (\frac{10^7}{2n}) points. Thus, the total raw score is:}\ &T = a\cdot \frac{10^7}{n} + b\cdot\Bigl(\frac{10^7}{n}+1\Bigr) + c\cdot \frac{10^7}{2n}. \end{aligned} ]
Since Blue takes the floor of (T) to get the final score (s), we have
[ \lfloor T \rfloor = s. ]
It can be shown that under the rules and given input ranges, the answer (i.e. the values of (a, b, c, d)) is unique.
Your task is to determine the values of (a, b, c, d) given (n), (m), and (s).
Input Format:
The input contains three space‐separated integers:
- \(n\) \( (1 \leq n \leq 10^5) \): the total number of problems.
- \(m\) \( (0 \leq m \leq n) \): the number of problems that did not score full marks.
- \(s\): the final total score after bonuses and flooring.
Output Format:
Output four space‐separated integers:
(a) (b) (c) (d)
which represent the number of problems with full score without bonus, with bonus, half score, and zero score respectively.
Note: It is guaranteed that a unique solution exists under the given conditions.
Example
For example, if (n = 10), (m = 4), and the distribution is chosen as follows:
- Full score problems: \(a+b = 6\). Suppose \(a = 4\) and \(b = 2\).
- Non full-score problems: \(c+d = 4\). Suppose \(c = 3\) and \(d = 1\).
Since each problem has a base score of (10^7/10 = 10^6) and half score is (5\times10^5), the raw total score is:
[ T = 4 \times 10^6 + 2 \times (10^6+1) + 3 \times 5\times10^5 = 7500002. ]
Taking the floor gives (7500002) (which is (s)). Hence, the output is:
4 2 3 1
inputFormat
The input consists of a single line with three space-separated integers: (n), (m), and (s), representing the number of problems, the number of problems that did not receive full marks, and the final total score respectively.
outputFormat
Output four space-separated integers: (a), (b), (c), (d), which are the numbers of problems with full score without bonus, full score with bonus, half score, and zero score respectively.
sample
10 4 7500002
4 2 3 1