TPORT - Teleport
Little Aron has to visit the planets of one system. Imagine that the planets are ordered in line and labeled with the numbers 1, ..., n.
Aron has n-1 teleports labeled with 1, 2, ..., n-1. The teleport labeled with t could transmit only once, one human from a planet labeled with m to the planets with label m+t or m-t, if such planet exists. Using a space-stop Aron could go to the planet labeled with k, i.e. he starts his journey from a planet with a label k. For the given n and k you have to find the best way Aron can use the teleports in order to visit as many different planets of the system, as possible.
First line containts two integers, n and k (1 <= k <= n <= 1 000 000).
Output should contain indices t, of the teleports that Aron used, in the order in which he used them. Moreover you have to output t if he used the teleport to jump from a planet with the smaller number to a planet with a higher, and -t if he jumped from a planet with a higher number to a planet with a smaller number.
If there are several solutions with the same number of teleports, you can output any one of them.
4 -5 3 -1 2
NOTE - A simpler version of this task appeared on ITI 2012, Shumen.
If we said that k <= n we haven't said anything false, it's still true. And about the judge, you have nothing to worry about, it will grade the submissions as it should, accepting every optimal solution with valid steps.
you said :