#P10876. Non-Intersecting Segments Game
Non-Intersecting Segments Game
Non-Intersecting Segments Game
In this problem, you are given (N) points ((x_i, y_i)) on a two-dimensional plane with the guarantee that no three points are collinear. Two players, A and B, play a game starting with player A. They take turns choosing two distinct points ((x_i, y_i)) and ((x_j, y_j)) ((i \neq j)). A player may draw the segment connecting these two points if and only if the new segment does not intersect any of the previously drawn segments (note that segments may intersect at their endpoints). The first player who cannot make a move loses the game.
Both players are assumed to be perfect. It turns out that the maximum number of segments that can be drawn without intersections is (3N-3-h), where (h) is the number of points on the convex hull of the given set. Thus, the game is equivalent to a simple alternating move game where the total number of moves is (3N-3-h). If this number is odd, player A wins; if it is even, player B wins.
inputFormat
The first line contains an integer (N) which denotes the number of points on the plane. The following (N) lines each contain two space-separated numbers representing the coordinates (x_i) and (y_i) of each point. It is guaranteed that no three points are collinear.
outputFormat
Output a single character: (A) if player A wins under perfect play, or (B) otherwise.
sample
3
0 0
1 0
0 1
A