Canadian Computing Competition: 2014 Stage 1, Senior #5
You have a pet Fox who loves treats. You have neighbours at distinct locations (described as points on the Cartesian plane) which hand out treats to your pet Fox, and each neighbour has an unlimited number of treats to give out. The origin (which is where the Fox starts) will not be one of these locations.
What does the Fox say, in order to get these treats? That is a good question, but not our concern. The Fox moves from location to location to gather exactly one treat from each location on each visit. He can revisit any previous location, but cannot visit the same location on two consecutive visits.
Your Fox is very lazy. The distance your Fox is willing to travel after each treat will strictly decrease. Specifically, the distance from the origin to his first treat location must be larger than the distance from his first treat location to his second treat location, which in turn is larger than the distance between his second treat location and his third treat location, and so on.
What is the largest number of treats your Fox gathers?
Input Specification
The first line contains the integer (). The next lines each contain , followed by a space, followed by , for () representing the coordinates of the location. The following additional constraints will apply:
- At least 20% of the marks will be for test cases where ;
- at least 40% of the marks will be for test cases where ;
- the remaining marks will be for test cases where .
Output Specification
The output is one integer, the largest number of treats your Fox can gather.
Sample Input
5
5 8
4 10
3 1
3 2
3 3
Output for Sample Input
6
Explanation of Output for Sample Input
The Fox performs the visits in the following order (with the indicated distances):
- to with distance ;
- to with distance ;
- to with distance ;
- to with distance ;
- to with distance ;
- to with distance .
Comments
Appears to be impossible for both Python 3 and PyPy 3 with the constraints given.
This seems to be true, there are no AC submissions. A language specific Time limit could be implemented.
Memory/Time limit seems overly strict for Java.
When the question states "origin", does that mean the origin as described in a Cartesian plane (so at ), or does it just mean the Fox's starting position (as in the Fox may start at any coordinate between and ).
The origin is , which is also where the fox starts.
Can the fox travel back to the origin after visiting a neighbour?
EDIT: Probably not.
No because it's not one of the "locations"
This comment is hidden due to too much negative feedback. Show it anyway.