当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3429:Geometry with a ruler

题目描述

Classic geometric construction is based on two instruments: ruler and compass. However, some constructions are possible using only the ruler. Specifically, let us define that if we have a set of N points, we can select two pairs of them, draw a line through each pair, and construct a new point as an intersection of these two lines. New point can then be added to the set as (N + 1)-th point, and the process repeated.

Such geometric constructions are abstract notions, and attempt to verify them with physical pencil and ruler can lead to errors caused by imprecision of these instruments. So you are tasked to write a program that does exact verification.

Your program must read a set of points and a sequence of constructing operations and find out whether the point with coordinates (0, 0) is one of the constructed points. Note that, similar to physical instruments, floating point calculations performed by computers are also imprecise. This should not, of course, alter verification results.

输入解释

Input file contains number of points N followed by their integer coordinates x1 y1 x2 y2 ... xN yN. Next comes number of construction operations M followed by M quads of integers ai bi ci di, where k-th quad means that a new point is constructed as an intersection of lines containing pairs of points ai, bi and ci, di. Such a point is guaranteed to exist. Constructed point is assigned a number N + k and can be used in following operations.

Constraints

4 ≤ N ≤ 100, 1 ≤ M ≤ 10, −106xi, yi ≤ 106

输出解释

Output file must contain a single integer — number of the first operation which constructs a point (0, 0), or 0 (zero), if there is no such operation.

输入样例
Sample Input 1
4
-1 -1  -2 2   2 2  1 -1
1
1 3 2 4
Sample Input 2
4
-1000 -1000  -2000 2000  2001 2000  1000 -1000
1
1 3 2 4
输出样例
Sample Output 1
1
Sample Output 2
0
提示

Bold texts appearing in the sample sections are informative and do not form part of the actual data.


该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3429

最后修改于 2020-10-29T07:01:24+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000 65536