Problem Statement | |||||||||||||
N checkers are placed on an infinitely large board. The i-th checker is in the cell at row x[i], column y[i]. There can be more than one checker in the same cell. A move consists of taking one checker and moving it one cell up, down, left or right. Return a int[] containing exactly N elements, where the i-th element (0-based) is the minimum number of moves necessary to end up with at least i+1 checkers in the same cell. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
| - | x will contain between 1 and 50 elements, inclusive. | ||||||||||||
| - | y will contain the same number of elements as x. | ||||||||||||
| - | Each element of x will be between 1 and 1,000,000, inclusive. | ||||||||||||
| - | Each element of y will be between 1 and 1,000,000, inclusive. | ||||||||||||
Examples | |||||||||||||
| 0) | |||||||||||||
| |||||||||||||
| 1) | |||||||||||||
| |||||||||||||
| 2) | |||||||||||||
| |||||||||||||