Ограничения: время – 250ms/500ms, память – 256MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод
Послать решение Blockly Посылки Темы Где Обсудить (0)
The Alien Monster is a giant squid-like monster with one eye and
dozens of long muscular tentacles.
It was created by Ozymandias as part of his plan
to save the world from a nuclear holocaust.
He is going to teleport the Monster to New York at the point `(x,\ y)`,
where it will destroy buildings with its tentacles.
Ozymandias wants to keep Manhattan that occupies an axis-aligned rectangle with
diagonally opposite corners at the points `(x_1,\ y_1)` and `(x_2,\ y_2)`.
Write a program to help Ozymandias the length of the Monster's tentacles so that Manhattan remains intact.
Input
The input consists of a single line containing six space-separated integers `x`, `y`, `x_1`, `y_1`, `x_2`, and `y_2`,
each in the range [-999,999].
It is guaranteed that `x_1` < `x_2` and `y_1` < `y_2`, and that `(x,y)` is strictly outside
the axis-aligned rectangle with corners at `(x_1,\ y_1)` and `(x_2,\ y_2)`.
Output
Print the minimum distance from the Monster’s position to Manhattan, with a absolute error no more than 0.001.
Sample Input 1
7 3 0 0 5 4
Sample Input 2
6 0 0 2 7 6
Sample Input 3
3 -4 -3 -1 -1 2