- Time limit: 1.00 s
- Memory limit: 512 MB
Your task is to arrange the coins so that each cell contains exactly one coin. On each move you can choose any coin and move it one step left, right, up or down.
What is the minimum number of moves if you act optimally?
The first input line has an integer $n$: the width of the grid.
After this, there are two lines that describe the grid. Each line has $n$ integers: the number of coins in each cell.
Print one integer: the minimum number of moves.
- $1 \le n \le 10^5$
0 1 0 1
2 0 1 3