1607 - Triangles
Time Limit : 1 Second
Memory Limit : 128 MB
- You are given a figure consisting of n points in a 2D-plane and m segments connecting some of them. We guarantee that any two segments don't share points except their ends and there's no more than one segment between the same pair of points. Please count the total number of triangles in the given figure.
- There're multiple test cases. In each case:
The first line contains two positive integers n and m. (n <= 200, m <= 20000)
Each of the following n lines contains two real numbers xi and yi indicating the coordinates of the ith point. (-100000 < xi, yi < 100000)
Each of the following m lines contains four real numbers xi, yi, xj , yj . It means (xi, yi) and (xj , yj) are connected by a segment. We guarantee that these points are part of the given n points.
- For each test case, print a single line contains the total number of triangles in the given figure.
Please see sample for more details
- sample input
4 5 0 0 1 1 2 0 1 0 0 0 1 1 1 1 2 0 2 0 1 0 1 0 0 0 1 1 1 0
- sample output
- The 7th(2012) ACM Programming Contest of HUST Problem Setter: Zhou Zhou