459. Choreographer Problem
Time limit per test: 0.75
second(s)
Memory limit: 65536
kilobytes
input: standard
output: standard
As you probably know, choreography is the art of making dances. But it is not a so wellknown fact that it is also the science of making dances.
There are
n dancers numbered from 1 to
n in the dance troupe, and all of them are working hard to create a new original dance. Before the dance starts each dancer puts on his special handmade costume, and he has to wear this costume for the duration of the entire dance.
It is known that the costume of
ith dancer is similar to the costumes of (
i1)th and (
i+1)th dancers (therefore the dancers are similar too), but at the same time,
ith dancer is not similar to any other dancer. Therefore, (
i1)th and (
i+1)th dancers are not similar. If
n > 1, then the first dancer has the only similar dancer, the last dancer has the only similar dancer, and all other dancers have exactly two similar dancers.
The dance starts and ends with an empty stage. The stage should not be empty during the dance. Each minute one of the following changes happens on the stage:
 one dancer (who is currently not on the stage) appears;
 one dancer (who is currently on the stage) leaves the stage;
 one dancer takes the place of another dancer similar to him/her (basically the dancers switch over — one dancer leaves the stage, while a similar dancer appears on the stage)
At every moment of time the stage must not have more than
k dancers, because spectators may lose attention if there are too many dancers on the stage.
Now choreographer is thinking about arranging the dance in such a way that each set of the dancers containing no more than
k dancers appears on the stage exactly once. Your job is to write a program to help the choreographer.
Input
The first line contains two positive integer numbers
n,
k (1 ≤
n ≤ 20; 1 ≤
k ≤
n).
Output
Print the only line describing the dance. The substring
+
i means that the
ith dancer appears on the stage, the substring

i means that the
ith dancer leaves the stage. The substring
++
i means that the
ith dancer leaves while the similar (
i+1)th dancer appears, and

i means that the
ith dancer leaves while the similar (
i1)th dancer appears. The output will be processed from the left to the right.
If there are many solutions, you may output any of them. If there is no solution, print 0 to the only line of output.
Example(s)
sample input

sample output

2 1

+1++12
