Dendroctonus
Time limit8sMemory limit512 MB
Decide whether the infected and non-infected points can be separated by a single circle centered anywhere, where boundary non-infected points are allowed but interior ones are not.
- Level
Hard8 of 10
- Topics
- Geometry, Brute force, Implementation, Math
- Solved
- No attempts yet
Problem

Mountain pine beetles (Dendroctonus ponderosae) are small pests that bore into trees and cause a huge amount of damage. Their population has grown sharply, and scientists want to know where the outbreak started. In particular, they want to know whether there was a single outbreak or several of them. If there is more than one outbreak, they must raise the alert level.
In one outbreak the beetles start at a single location, called the initial infection point, and slowly work their way outwards. A tree inside the infection area is infected. A tree outside the infection area is not infected. A tree on the boundary of the infection area may or may not be infected. The infection area is always a circle centred at the initial infection point.
You are given the locations of the infected and the non-infected trees. Decide whether there is enough evidence to raise the alert level.
Input
The first line contains one integer (), the number of trees.
Each of the next lines describes one tree. The line contains two integers () and (), the location of the tree, and one character that tells whether the tree is infected. If is I, the tree is infected. If is N, the tree is not infected. Trees are single points on the plane. The initial infection point of an outbreak does not have to be a tree and does not have to be at integer coordinates. The trees are at distinct locations.
Output
Print Yes if more than one outbreak is guaranteed, and No otherwise.
A single outbreak explains the observation when some circle holds every infected tree in its interior or on its boundary and holds no non-infected tree in its interior.