No.3068 Speedrun (Hard)
タグ : / 解いたユーザー数 63
作問者 : 👑
hamamu
Problem Statement
You are going to participate in a speedrun contest held on yukicoder.
In the speedrun contest, problems divided into $4$ difficulty levels $1, 1.5, 2, 2.5$ are given.
There are $A$ problems of difficulty $1$, and it takes $P$ minutes to solve $1$ of them.
There are $B$ problems of difficulty $1.5$, and it takes $Q$ minutes to solve $1$ of them.
There are $C$ problems of difficulty $2$, and it takes $R$ minutes to solve $1$ of them.
There are $D$ problems of difficulty $2.5$, and it takes $S$ minutes to solve $1$ of them.
In this speedrun, you solved $N$ problems in exactly $T$ minutes.
Output $1$ possible combination of the numbers of problems solved for each difficulty.
Note that in this problem, only inputs for which a solution exists are given.
Constraints
- All inputs are integers
- $1 \leq A, B, C, D \leq 10^4$
- $1 \leq P, Q, R, S \leq 10^4$
- $1 \leq T \leq 4 \times 10^8$
- $1 \leq N \leq A + B + C + D$
- At least $1$ solution exists for the given input
Input
The input is given from standard input in the following format.
$A$ $B$ $C$ $D$ $N$ $P$ $Q$ $R$ $S$ $T$
Output
If you solved $n_a, n_b, n_c, n_d$ problems of difficulty $1, 1.5, 2, 2.5$ respectively, output in the following format. If there are multiple combinations $(n_a, n_b, n_c, n_d)$ satisfying the conditions, any of them will be accepted.
$n_a$ $n_b$ $n_c$ $n_d$
Sample
Sample 1
Input
1 3 3 3 8 5 10 15 20 120
Output
1 1 3 3
If you solve $1$, $1$, $3$, and $3$ problems of difficulty $1, 1.5, 2, 2.5$ respectively, the total time taken to solve them is $1 \times 5 + 1 \times 10 + 3 \times 15 + 3 \times 20 = 120$ minutes.
Besides this, the output 0 3 2 3 is also accepted.
Sample 2
Input
10000 10000 10000 10000 17426 3141 5926 5358 9793 129057901
Output
2718 2818 2845 9045
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。