This problem is a simplified version of ABC334F: Christmas Presents 2. Here, all the children are guaranteed to be on the one dimensional number line, i.e, $$$Y_i = 0$$$ and $$$S_y = 0$$$ for all points. With these restrictions, the answer would also be an integer instead of a real number.
There are $$$n$$$ children present on a number line, where the $$$i^{th}$$$ children is present at point $$$a_i$$$. Santa starts his journey at point $$$S_x$$$. He can only carry at max $$$K$$$ presents at any point of time.
For each $$$i$$$ from $$$1$$$ to $$$n$$$, print the minimum distance travelled by Santa to deliver one present each to the first $$$i$$$ children AND return back to his starting position.
Constraints
For each testcase, print $$$n$$$ integers denoting the minimum cost to give presents to the first $$$i$$$ children and return back to the starting position.
1 3 2 0 1 2 3
2 4 8
1 7 3 3 0 -3 -7 1 -5 2 8
6 12 20 24 36 36 46
This problem is a simplified version of ABC334F: Christmas Presents 2. Here, all the children are guaranteed to be on the one dimensional number line, i.e, $$$Y_i = 0$$$ and $$$S_y = 0$$$ for all points. With these restrictions, the answer would also be an integer instead of a real number.
There are $$$n$$$ children present on a number line, where the $$$i^{th}$$$ children is present at point $$$a_i$$$. Santa starts his journey at point $$$S_x$$$. He can only carry at max $$$K$$$ presents at any point of time.
For each $$$i$$$ from $$$1$$$ to $$$n$$$, print the minimum distance travelled by Santa to deliver one present each to the first $$$i$$$ children AND return back to his starting position.
Constraints
For each testcase, print $$$n$$$ integers denoting the minimum cost to give presents to the first $$$i$$$ children and return back to the starting position.
1 3 2 0 1 2 3
2 4 8
1 7 3 3 0 -3 -7 1 -5 2 8
6 12 20 24 36 36 46
This problem is a simplified version of ABC334F: Christmas Presents 2. Here, all the children are guaranteed to be on the one dimensional number line, i.e, $$$Y_i = 0$$$ and $$$S_y = 0$$$ for all points. With these restrictions, the answer would also be an integer instead of a real number.
There are $$$n$$$ children present on a number line, where the $$$i^{th}$$$ children is present at point $$$a_i$$$. Santa starts his journey at point $$$S_x$$$. He can only carry at max $$$K$$$ presents at any point of time.
For each $$$i$$$ from $$$1$$$ to $$$n$$$, print the minimum distance travelled by Santa to deliver one present each to the first $$$i$$$ children AND return back to his starting position.
Constraints
For each testcase, print $$$n$$$ integers denoting the minimum cost to give presents to the first $$$i$$$ children and return back to the starting position.
1 3 2 0 1 2 3
2 4 8
1 7 3 3 0 -3 -7 1 -5 2 8
6 12 20 24 36 36 46