ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1173. Lazy Snail

Why I always WA on text 2?
Posted by beststu 8 Jul 2008 13:54
Why I always WA on text 2?
Re: Why I always WA on text 2?
Posted by Fyodor Menshikov 24 Apr 2009 13:10
If you sort points by angle from Wally's home, there is one tricky case - when angle difference between two sequential points is greater than PI.

For example if angle range is [-PI; PI]:
0 0
3
-1 -1 1
0 1 2
-1 1 3
Program that sort angles will output
0
1
2
3
0
and it is wrong, 1-2 will intersect with 3-0.

Text for angle range [0; 2PI] is
0 0
3
1 1 1
0 -1 2
1 -1 3
Again sorting program will output
0
1
2
3
0
and again it is wrong, 1-2 will intersect with 3-0.

Hint: after sorting there may be not more than one pair of sequential points with angle difference greater than PI.
Re: Why I always WA on text 2?
Posted by wangbicheng1 18 Nov 2015 20:24
Thanks for the hint!