АВТ
Язык:

Дистанционный практикум по программированию

Задачи Online статус Соревнования
Новости Справка СДО
 
Здравствуйте, Гость! Войдите с паролем или зарегистрируйтесь.

1582. HHPaint

Ограничение времени: 1 сек.
Ограничение памяти:262144 КБайт
Баллы:100
Статистика Послать на проверку Задачу добавил 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


Статистика Послать на проверку Обсуждение задачи Автор/источник:
Задачи с соревнований и сборов / Сборы в Перми 2009 / 07.07.09 Большой контест /
1582. 1583. B - Square Root 1584. C - Interesting Places 1585. D - Road to Home
 
время генерации 0.328 сек.
© Copyright ВоГУ, АВТ, Носов Д.А., Андрианов И.А.