Canadian Computing Competition: 1997 Stage 2, Day 2, Problem 2
Earth is being attacked by space aliens yet again. The invasion is being tracked by time-lapse photography. Three photographs have been taken at equal time intervals. Your job is to predict the positions of the alien craft in the next photograph, so that they may be intercepted by Earth's defence force. Each alien craft appears as a point of light in the plane of the photograph.
Your input consists of three snapshots of the crafts' positions, taken at second intervals. During these intervals, each craft's speed and direction may be assumed to be constant. Your output consists of the coordinates at which the craft will appear seconds after the third snapshot. (i.e., the positions in the fourth snapshot if there were one.)
The first line contains a positive integer , the number of points of light in each picture. The next pairs of lines of input contain the coordinates of the points in the first picture, the -coordinate and the -coordinate on the same line. The next pairs of lines contain the coordinates of the points in the second picture, and the next pairs of lines contain the coordinates of the points in the third picture. The points in each picture are in no particular order.
Your output is the set of coordinates where the points of light will be seconds after the third picture. Print the number of points, followed by the coordinates of each point up to an absolute error of . If there is more than one solution, output any. If there is no solution, print
Sample Input 1
2 1.0 1.0 2.0 2.0 2.0 2.0 3.0 3.0 3.0 3.0 4.0 4.0
Sample Output 1
2 4.0 4.0 5.0 5.0
Sample Input 2
3 1.0 1.0 1.0 2.0 1.0 3.0 2.0 1.5 2.0 2.0 2.0 2.5 3.0 1.0 3.0 2.0 3.0 3.0
Sample Output 2
3 4.0 0.0 4.0 2.5 4.0 3.5
Explanation for Sample Output 2
Note that, for the second test case, another valid solution is .