4-th Bulgarian National Olympiad in Informatics

June 4, 1988

Selection round

A given square ABCD has sides parallel to the coordinate axes. The length of each side is 10 units. The vertices of the square have integer coordinates. A group of 5 points with integer coordinates within the square is colored in red, whereas another group of 5 points with integer coordinates within the square is colored in blue. The group of red points is connected, i.e. for any red point, there exists a neighbouring red point. Two points with integer coordinates are called neighbouring, if their coordinates differ by absolute value 1 only along either Ox or Oy axes, while the other coordinates of these two points are the same. It is given, that the group of blue points is connected too. Both groups can be moved by applying translation and rotation.

Problem 1.

Write a subroutine that inputs the coordinates of the square ABCD and the coordinates for the red and blue points, doing a check of the inputted data.

Problem 2.

Write a subroutine, that creates a sequence of commands, each one belonging to the following types:

T(a, b): C
R(c, d).f: C


T is translation;
(a, b) are coordinates of the translation vector;
C is group's color, red or blue;
R is rotation;
(c, d) are coordinates of the rotation centre;
f is angle of the turn, which can be equal only to 90, 180 or 270 degrees;
END is the end of the list of commands.

The sequence should contain such necessary moves, so that the red points following these moves will become fully coincidental with the blue ones when all the commands are executed. In case of impossibility, your program must report an appropriate message. Each of the commands T or R is applicable to the whole group of points.

Problem 3.

Write a subroutine, that executes the sequence of command created in Problem 2 and renders the action of each command on the computer screen.

Problem 4.

Write a subroutine, that removes a minimal number of red points, so that the rest of them can be placed over the blue ones.

Source: Obuchenieto po matematika i informatika, journal published by Bulgarian Ministry of Education, n. 5, 1988, pp. 59-59.
© The text is translated from Bulgarian by Emil Kelevedzhiev (keleved@math.bas.bg)
Return to the Home Page of Bulgarian Mathematics and Informatics Competitions.