Eggplant Summoning Magic
Time limit4sMemory limit1024 MB
Given N integer points in 3D, pick a structure-preserving map and M of the points that become a regular M-gon, maximizing N times M.
- Level
Hard8 of 10
- Topics
- Geometry, Math, Brute force
- Solved
- No attempts yet
Problem
The Korean Eggplant Association is studying many ways to supply high-quality eggplants at low prices. Eggplant summoning magic is a recently developed method that sacrifices a small number of eggplants to summon a large number of them.
To use eggplant summoning magic, you must float eggplants in the air and chant a spell. Represent each eggplant's position as a point in three-dimensional coordinate space, and apply a suitable function to each point. The function must satisfy the following conditions.
- The domain and codomain of are the set of all points whose coordinates are all rational numbers.
- For any two distinct points , , and are different.
- Three distinct points , , lie on one line if and only if , , lie on one line.
- For two distinct points , and two distinct points , , line is parallel to line if and only if line is parallel to line . If , then lines and are parallel.
After applying to all points, choose of the points so that the polygon with those points as vertices is a regular -gon. Then you can summon eggplants. () If no suitable exists, or no suitable set of points can be chosen, the summoning fails. Given the positions of the eggplants, find the maximum number of eggplants you can summon by choosing one suitable function and one set of points, exactly once.
Input
The first line contains the number of eggplants . ()
Each of the next lines contains the position of one eggplant as a point. The -th line contains three integers , , separated by spaces. ()
All eggplant positions are distinct.
Output
Print on the first line the maximum number of eggplants you can summon by choosing one suitable function and one set of points, exactly once.