ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила

1599. Winding Number

Ограничение времени: 1.0 секунды
Ограничение памяти: 64 МБ
You have just completed the construction of your model railway. The railway is made in a form of a closed route, the tracks may intersect and overlap one another in different levels. You're standing at some point and follow the locomotive with your eyes. Once the locomotive completes a full circle you want to say how many full turns around your axis you made.

Исходные данные

The first line contains the integer n (3 ≤ n ≤ 5000). Each of the next n lines contains a point with integer coordinates (up to 109 by absolute value) that represents the track joint. The tracks are straight segments between successive points in this list. The last joint is connected to the first one with one more track.
The next line contains the integer m (1 ≤ m ≤ 5000). Each of the next m lines contains a point with integer coordinates (up to 109 by absolute value) that represents a standing point.

Результат

For each standing point output “EDGE” if you stand on one of the tracks. Otherwise, output the number of full turns in positive direction.

Пример

исходные данныерезультат
8
-2 -2
-5 1
-2 4
1 3
-2 0
-3 1
-2 2
1 1
3
-2 1
0 0
1 2
-2
EDGE
0
Автор задачи: Vladimir Yakovlev