Re: Why I always WA on text 2?

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.