Nurie
Time limit1sMemory limit512 MB
Given n circles and k paint colors, find the maximum number of bounded regions that can be painted so that adjacent regions never share a color.
Problem
Paper has circles drawn on it. A rabbit has colors of paint and colors the paper following these rules.
- Each region is either painted with one color of paint or left unpainted. A region is a part of finite area bounded by a set of arcs.
- Two adjacent regions cannot be painted with the same color. Two regions are adjacent when an arc is shared by part of their boundaries. Two regions that share only finitely many points are not adjacent.
- Leaving two adjacent regions both unpainted is allowed.
The rabbit wants to paint as many regions as possible. Find the maximum number of regions that can be painted.
Input
The first line contains and (, ). Each of the next lines contains integers , , (, ). No two circles coincide.
No two distinct points within distance of each other are among the intersection points of any two circles.
Output
Print the maximum number of regions that can be painted, on one line.