Problem B: Triangles

BUBBLE CUP 2008
STUDENT PROGRAMMING CONTEST
Problem B: Triangles
You are given two triangles A1B1C1 and A2B2C2 in the plane. Is there an isometric transformation of the
plane that maps one triangle onto another, preserving the order of vertices? If so, what kind of
transformation is that?
Input
12 integer numbers in one line separated by a space, which are the coordinates of vertices in the
following order: A1x, a1y, b1x, b1y, c1x, c1y, a2x, a2y, b2x, b2y, c2x, c2y. Vertices of one triangle are not
collinear, i.e. triangles do exist. All coordinates are between -10000 and +10000, inclusive.
Output
One of the following letters: N, I, T, R, S, O.
Here is the meaning for each letter:
N:
there is no isometric transformation mapping one triangle onto another;
I:
transformation asked for is the identity transformation;
T:
transformation asked for is a translation;
R:
transformation asked for is a rotation;
S:
transformation asked for is an axial symmetry;
O:
transformation asked for is some other isometric transformation.
Example input:
112212576858
Example output:
T
Memory limit: 16 MB
Time limit:
0.1 sec
Microsoft Development Center Serbia