No.2465 Dilated Water Simulation
About This Problem
Nothing went well, from the recruitment of testers to the contest itself, and there is a high chance that this problem contains flaws; it has therefore been placed among the unproven problems.
Respect
This problem is a version of "Water Simulation", set by noya2, made harder in a simple way.
Problem Statement
There are $L$ containers (container $1$ , container $2$ , $\ldots$ , container $L$ ). The capacity of container $i$ is $V _ i$ . Initially, container $1$ contains water of volume $V _ 1$ , and the other containers contain nothing.
Operation $t$ $(t=1,2,3,\ldots )$ is defined as follows.
- Let $a=1+((t-1) \bmod L), b=1+(t\bmod L)$ . Pour the water in container $a$ into container $b$ until container $b$ becomes full or container $a$ becomes empty.
Find the amount of water in each container after performing the operations in order from operation $1$ to operation $N$ .
Constraints
- All values are integers.
- $4 \leq L \leq 200\, 000$
- $1 \leq N \leq 10^{18}$
- $1 \leq V_i \leq 10^{9}$
Input
$L$ $V_1$ $V_2$ $\ldots$ $V_L$ $N$
Output
Find the volumes of water in containers $1,2,\ldots ,L$ after the $N$ operations, and output them in this order, separated by spaces.
Sample
Sample 1
Input
4 31 41 59 26 535897932
Output
26 0 5 0
This has the same meaning as Sample 3 of Water Simulation.
Sample 2
Input
5 12 5 4 3 2 11
Output
4 5 2 1 0
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
Nachia