#P4176. Different Flowers in n-Dimensional Space

    ID: 17423 Type: Default 1000ms 256MiB

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 nn–dimensional space. A point in nn–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 r>0r>0. All flowers whose distance from the reference point is less than rr 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

d=i=1n(xiwi)2.d=\sqrt{\sum_{i=1}^{n}(x_i-w_i)^2}.

Each time a spell is cast, any flower in its area gains a new property. After mm spells the property of a flower located at some point in nn–dimensional space is represented by an mm–bit binary string $$ (a_1,a_2,\cdots,a_m), $$ where ai=1a_i=1 if the flower was affected by the ii–th spell and ai=0a_i=0 otherwise. Different properties correspond to different flowers.

The problem is: given nn and mm, if the Fairy is free to choose the mm 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 n=1n=1 than in higher dimensions. In fact, for n=1n=1 the answer is m+1m+1, while for n2n\ge 2 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 nn and mm.

inputFormat

The input consists of a single line containing two positive integers nn and mm separated by a space, where nn indicates the dimension of the space and mm is the number of magic spells.

outputFormat

Output a single integer, which is the maximum number of different flowers (i.e. different mm–bit attribute strings) that can be obtained.

sample

1 1
2