Under construction

Still being built. Things may change

Nurie

Time limit1sMemory limit512 MB

Summary
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.
Level

Medium7 of 10

Topics
Graph, Geometry
Solved
No attempts yet

Problem

Paper has nn circles drawn on it. A rabbit has kk 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 nn and kk (1≤n≤201 \le n \le 20, 1≤k≤1091 \le k \le 10^9). Each of the next nn lines contains integers xix_i, yiy_i, rir_i (−1000≤xi,yi≤1000-1000 \le x_i, y_i \le 1000, 1≤ri≤10001 \le r_i \le 1000). No two circles coincide.

No two distinct points within distance 10−310^{-3} 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.

Examples1

  1. Example 1

    Input
    2 1
    10 0 10
    20 0 10
    
    Expected output
    2