#K63072. Optimal Hospital Location

    ID: 31672 Type: Default 1000ms 256MiB

Optimal Hospital Location

Optimal Hospital Location

In this problem, you are given two integers (n) and (m), which represent the number of horizontal avenues and vertical streets in a city grid respectively. Your task is to determine the optimal intersection where a hospital should be located so that the maximum Manhattan distance between the hospital and any intersection is minimized. The Manhattan distance between two points ((x1, y1)) and ((x2, y2)) is given by ( |x1 - x2| + |y1 - y2| ). It can be shown that positioning the hospital at the center of the grid minimizes the maximum distance. For example, if (n = 3) and (m = 5), the optimal intersection is ((2, 3)).

inputFormat

The input consists of a single line containing two integers (n) and (m) separated by space, where (n) is the number of horizontal avenues and (m) is the number of vertical streets.

outputFormat

Output the optimal intersection as two space-separated integers representing the avenue and street number, respectively.## sample

3 5
2 3

</p>