#P4176. Different Flowers in n-Dimensional Space
Different Flowers in n-Dimensional Space
Different Flowers in n-Dimensional Space
In ancient times there was only one kind of flower called “Yuan”. Later, a magical Fairy of Flowers appeared who could endow the flowers with additional properties. Thus, the Yuan flowers began to mutate into a huge diversity of types. The Fairy may cast her magic in 2‐dimensional space (the plane), 3‐dimensional space, or even in –dimensional space. A point in –dimensional space is represented by a vector $$ (x_1,x_2,\cdots,x_n). $$
When the Fairy casts a magic spell, she chooses an arbitrary reference point $$ (w_1,w_2,\cdots,w_n) $$ and an arbitrary radius . All flowers whose distance from the reference point is less than will be affected by that magic. Here the distance between two points $$ (x_1,x_2,\cdots,x_n) $$ and $$ (w_1,w_2,\cdots,w_n) $$ is defined as
Each time a spell is cast, any flower in its area gains a new property. After spells the property of a flower located at some point in –dimensional space is represented by an –bit binary string $$ (a_1,a_2,\cdots,a_m), $$ where if the flower was affected by the –th spell and otherwise. Different properties correspond to different flowers.
The problem is: given and , if the Fairy is free to choose the spells arbitrarily (that is, she may choose any reference point and any radius for each spell), what is the maximum number of different kinds of flowers that can possibly appear?
Note: In 1–dimensional space a ball is just an open interval. It can be shown that the maximum number of different regions (and hence different attribute strings) achievable is different when than in higher dimensions. In fact, for the answer is , while for the answer is given by
$$\begin{cases}2^m,&\text{if } m\le n,\\[1mm]2\displaystyle\sum_{j=0}^{n} {m-1 \choose j},&\text{if } m>n.\end{cases} $$You are to compute and output this maximum number, given and .
inputFormat
The input consists of a single line containing two positive integers and separated by a space, where indicates the dimension of the space and is the number of magic spells.
outputFormat
Output a single integer, which is the maximum number of different flowers (i.e. different –bit attribute strings) that can be obtained.
sample
1 1
2