Points
Time limit1sMemory limit128 MB
Count the distinct straight lines in 3D space that pass through at least three of the given points.
- Level
Medium7 of 10
- Topics
- Geometry, Hash map, Math, Implementation
- Solved
- No attempts yet
Problem
You and your friends invented a game called "Trivial Points", played by placing points in 3D space according to a certain set of rules. To build a computer version of the game, you must write a program that, given a set of points in 3D space, counts how many distinct straight lines pass through at least 3 of the given points.
Input
The first line contains a single integer , the number of points. Each of the next lines contains three integers , , , separated by single spaces, the coordinates of the -th point.
Output
Print a single integer: the number of distinct lines that pass through at least 3 of the given points.
Constraints
- are integers
- All given points are distinct.
Hint
In the sample, one line passes through the four collinear points , , , , and another line passes through , , . Both lines contain at least 3 points (the point lies on both), so the answer is .