0% found this document useful (0 votes)
58 views1 page

1 Matrix en

The document describes a programming challenge to write a program that splits a set of points in the plane into two disjoint sets such that both sets are centrally symmetric. The input consists of the number of points followed by their x and y coordinates. If there are multiple solutions, the program should output the coordinates of the centers of the two galaxies for each solution. If no solution exists, the program should output "MATRIX PANIC".

Uploaded by

Vikram Saurabh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views1 page

1 Matrix en

The document describes a programming challenge to write a program that splits a set of points in the plane into two disjoint sets such that both sets are centrally symmetric. The input consists of the number of points followed by their x and y coordinates. If there are multiple solutions, the program should output the coordinates of the centers of the two galaxies for each solution. If no solution exists, the program should output "MATRIX PANIC".

Uploaded by

Vikram Saurabh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

2D Matrix

CPSPC 2010 Prague, Den 1.

Submit: matrix.c / matrix.cpp / matrix.pas


Input: stdin
Output: stdout

Time limit:
2s
Memory limit: 64 MB
Points:
100

Our story takes places in the times, when Matrix did not have graphics card which would be powerful enough to create
3D illusion and therefore the people should be satisfied with 2D world. And in this 2D world, it was necessary to model the
universe. Such universe consits from galaxies and galaxies consist from stars. Unfortunately, Matrix did not have too much
memory, so in fact there were only two galaxies. And for those two galaxies, Matrix spent its last memory and thus it cannot
remember for stars to which galaxy they belong. And that is the reason why it does the following trick. Both galaxies are
centrally symmetric. Then it is possible to calculate to which galaxy every star belongs.
Task:
Write a program, that splits the given set of points in the plane into two disjoint sets such that both sets are centrally
symmetric. If there are more such divisions print all of them. If there is not such division, something went terribly wrong
and you have only to print MATRIX PANIC.
Input:
On the first line of the input, there is the integer number N (N 150) followed by N lines. Every line then contains
two integers Xi and Yi (109 Xi , Yi 109 ) which stand for the coordinates of the i-th star. You can assume, that the
given set is not centrally symmetric and therefore both galaxies are nonempty.
Output:
The output consists of the several lines. The number of lines is equal to the number of solutions. Each line stands for
one solution and contains four numbers. The first two of them stand for the coordinates of the centre of the first galaxy and
the second two stand for the coordinates of the centre of the second galaxy. The coordinates have to be written precisely
with all decimal digits without trailling zeroes. If there does not exist any division into two sets, write only the message
MATRIX PANIC.
Example:
input
6
0 2
2 0
2 2
0 0
4 0
4 1

output
1 1 4 0.5
2 0.5 2 1
2 1 2 0.5
4 0.5 1 1

You might also like