#P9403. [POI 2020/2021 R3] Les Bitérables
[POI 2020/2021 R3] Les Bitérables
Background
Translated from XXVIII Olimpiada Informatyczna - Stage III Les Bitérables.
d1t2。
Problem Description
There are moments. At moment , a configuration is given, meaning that within the interval on the number line, items exist at and only at positions .
At position and position , there are infinitely many items.
You may pay a cost of to move one item one position to the left or one position to the right.
For each pair of adjacent moments, ask for the minimum total cost needed to transform the previous configuration into the next configuration.
Input Format
The first line contains two positive integers .
The next lines each describe the configuration at one moment. Each line starts with a non-negative integer , followed by positive integers . It is guaranteed that .
Output Format
Output lines, each containing one integer: your answer.
3 10
2 4 7
3 3 6 8
1 5
4
6
见附件
6252500
6252500
见附件
999990000
999990000
999990000
999990000
生成器:/paste/3igmip11
生成器:/paste/fusadpm0
Hint
For all testdata, , , .
| Subtask ID | Additional Constraints | Score |
|---|---|---|
| 1 | 5 | |
| 2 | 10 | |
| 3 | 12 | |
| 4 | 27 | |
| 5 | If , then | 11 |
| 6 | 35 |
Translated by ChatGPT 5