Time Limit: 20000/10000 MS (Java/Others)

Memory Limit: 65536/65536 K (Java/Others)

Your school has a large ground. Recently the school wants a new ground similar to the former one.

The ground is a simple polygon. Suppose it has n edges and the old one is A0,A1,…,An-1, the new one is B0,B1,…,Bn-1.

They must be one-to-one mapping.

The new ground can be only worked out by rotating, expanding, contracting and shifting, but not flipping.

Now you know all the points of the old ground, B0, and B1. Can you calculate the other points of the new ground?

The ground is a simple polygon. Suppose it has n edges and the old one is A0,A1,…,An-1, the new one is B0,B1,…,Bn-1.

They must be one-to-one mapping.

The new ground can be only worked out by rotating, expanding, contracting and shifting, but not flipping.

Now you know all the points of the old ground, B0, and B1. Can you calculate the other points of the new ground?

The first line contains one integer T representing the number of test cases.

For each case, first line contains one integer n (3<=n<=10000).

Then n lines follow. The i-th line has two integers representing the coordinate of the point Ai. (For each 0<=i<j<n, Ai doesn't equals Aj)

Following one line contains four integers. The first two integers represent the coordinate of the point B0, and the second two integers represent the coordinate of the point B1. B0 never equals B1.

All coordinates are within [-10000, 10000].

The old ground always has a positive area.

For each case, first line contains one integer n (3<=n<=10000).

Then n lines follow. The i-th line has two integers representing the coordinate of the point Ai. (For each 0<=i<j<n, Ai doesn't equals Aj)

Following one line contains four integers. The first two integers represent the coordinate of the point B0, and the second two integers represent the coordinate of the point B1. B0 never equals B1.

All coordinates are within [-10000, 10000].

The old ground always has a positive area.

提交代码