- 总时间限制:
- 1000ms
- 内存限制:
- 65536kB

- 描述
As shown in the picture below, there are three separate blocks composed of square units. Each step you can move a block upward, downward, leftward or rightward.You need to ensure the moving block won't overlap with any other block during and after the movement.

For each block, there exists a smallest rectangle that covers the whole block, and we call it smallest covering rectangle (SCR). Your task is to find a series of movement, after which there's no overlapping part between any two blocks' SCRs. If such a series of movements exists, print the minimum number of movements required; if not, simply print -1.

- 输入
- The input consists of multiple cases.

In each case, the first line is three integers n1, n2 and n3, denoting the number of square units in each block. Three zeros denote end of the input.

Following the first line are n1 lines, each line being a pair of integers in the range between 0 and 9, which denote the coordinates of the square units in the first block. The same goes to the second and third blocks. - 输出
- For each case, the output is the minimum number of movements required.
- 样例输入
3 5 2 1 2 2 1 2 0 0 0 1 0 2 0 3 0 4 1 0 1 4 2 0 2 4 3 0 3 1 3 4 2 3 3 3 4 3 4 4 4 2 1 1 1 0 0 1 1 2 2 0 0 0

- 样例输出
5 0

- 提示
- Explanation

For the first sample input, we move the third block rightward by one unit, then move the first block upward by one unit, and lastly move the second block leftward by three units.

01 Use "long long" to calculate the answer

05 Expected Value of an Expression: Ai is less than 2^20

- 全局题号
- 15305
- 提交次数
- 0
- 尝试人数
- 0
- 通过人数
- 0