АВТ
Language: Russian
English

Remote Training on Programming

Problems Online status Contests
News FAQ E-learning
For authors:
Register  ||  Login
 
Hello, Guest! Please login or register.

1582. HHPaint

Time Limit: 1 seconds
Memory Limit:262144KB
Points:100
View Problem Statistics Submit Problem added debug

The famous in the Volga region H&H company decided to create a very special graphic tool. The head of H&H believes that it can be used by scientists for numerical experiments. That's why one of the parts of the tool is "triangulating" module. And this module is one you are responsible for.

You are given N points. No three points lay on the same line. Lets consider the polygon of minimal area containing all the points. Your task is to split the polygon to the set of not overlapped triangles in such a way, that all the vertices of the triangles are points from the given set. Each point should be used as a vertex of at least one triangle.

Входные данные

The first line of the input file contains number of points N (3 ≤ N ≤ 15000). Each of the following N lines contains the coordinates of the corresponding point ( - 106xi, yi ≤ 106, 1 ≤ iN). All coordinates are integers.

Выходные данные

Write in the first line of the output file the number of the triangles Q. Each of the following Q lines should contain description of the triangle. The description consists of three integers — numbers of points for each vertex of the triangle. The points are numbered from 1 to N in the order of their appearance in the input file. If there are several solutions, output any of them.

Пример

Входные данные
6
-10 0
10 0
0 3
-1 4
1 4
0 5
Выходные данные
7
1 2 3
1 3 4
1 4 6
2 3 5
2 5 6
6 4 5
3 4 5


View Problem Statistics Submit Problem discussion Author/source:
Problems from Contests and Camps / Trainings in Perm 2009 / 07.07.09 Big Contest /
1582. 1583. B - Square Root 1584. C - Interesting Places 1585. D - Road to Home
time generating 0.187 sec.
© Copyright VSU, AVT, Nosov D.A., Andrianov I.A.