Cruel games
Time limit5sMemory limit1024 MB
Alice picks a point off every obstacle line so that the worst-case number of segments blocking her view of Bob, over all his positions, is minimized.
- Level
Medium7 of 10
- Topics
- Geometry, Brute force, Implementation
- Solved
- No attempts yet
Statement
Alice and Bob play a cruel game on a plane.
There are obstacles on the plane, and each one is a line segment. First, Alice picks a point on the plane that does not lie on any line containing an obstacle, and stands there. Then Bob picks a point and stands there. After that, Alice shoots at Bob.
Bob wants to be safe, so he picks a point where as many obstacles as possible lie between him and Alice. If an endpoint of an obstacle lies on the segment connecting Alice and Bob, Bob is considered hidden behind that obstacle.
Alice wants to hit Bob, so she picks a point where as few obstacles as possible lie between her and Bob. Help her do that.
Input
The first line contains (), the number of obstacles. Each of the next lines contains four integers , the coordinates of the endpoints of an obstacle. No two obstacles share a point. All coordinates have absolute value at most 100.
Output
On the first line, print , the minimum number of obstacles that can end up between Alice and Bob when both play optimally.
On the second line, print the point where Alice should stand. The point must not lie on any line containing an obstacle.