The Stonehenge ruins are located in a special place, where M Earth energy lines intersect. The energy lines divide the Stonehenge plain into sectors. Each year, in the shortest day of the year, N druids gather on the plain for a ritual, which ensures large crops for next year. In order for the ritual to be successful it is necessary that each plain field delimited by the energy lines contain no more than one druid. The plain is in the shape of a square with the center in the origin of the coordinate axis and has side length L. The energy lines are straight lines. Druids are represented as dots and are not on the energy lines. |
![]() |
Task
Write a program that determines whether there are plain sectors where there are 2 or more druids.
Input Data
Input file druid.in contains no more than 5 sets of data, separated by a line that contains character #
The first line of each data set contains 3 positive integers separated by a space, N, M and L, with the meaning specified in the task.
Then follow N lines contain 2 integers separated by a space, xi yi - the coordinates of the druids (abscise and ordinate). The following M lines of the data set contain a triplet of positive integers , ai bi ci. The numbers correspond to the quotients of equation aix + biy + ci = 0, which describes energy line i.
Output Data
Output file druid.out will contain for each data set a line with the word YES if there is at least one sector on which there are two or more druids or the word NO if not. Answers are written in the order in which data sets appear in the input file.
Restrictions
druid.in | druid.out |
3 2 6 |
NO YES NO |
Time limit: 0.1 seconds/test
prof. Sergiu Corlat
Moldavian-Turkish High School, Chişinău, Republic of Moldova
Contact:scorlat@gmail.com