Boy Scout
Time limit1sMemory limit128 MB
Given N points in general position, find the longest closed route that always turns strictly left at every step, counting distinct points visited.
- Level
Medium7 of 10
- Topics
- Geometry, Dynamic programming, Sorting
- Solved
- No attempts yet
Problem
Every year the Boy Scouts hold their Olympics, and this year a new game is added.
The arena contains trees, each located at a point in the plane. A team chooses one tree and starts there. Whenever it moves from one tree to another it travels in a straight line. The team's score is the number of distinct trees it visits before returning to the tree it started from.
There is one rule: at every move the team must turn counterclockwise. That is, upon arriving at a tree, when heading to the next one it may rotate its heading to the left by strictly more than and strictly less than degrees. (Going straight, turning right, or reversing exactly backward are not allowed.)
Among all closed routes that obey this rule and return to the starting tree, you want to maximize the number of visited trees (the score). Given the positions of the trees, find the maximum achievable score.
Input
The first line contains the number of trees ().
Each of the next lines contains the coordinates of a tree: two real numbers , () separated by a space. Each coordinate is given with at most two digits after the decimal point.
No three trees lie on the same straight line.
Output
Print the maximum achievable score on the first line.