Point Set

3.2

4 votes
Searching algorithm, Binary search algorithm, Hard, Algorithms
Problem

You are given a point set S with N points (1N105) in K-dimensional (1K10) space.

We define dis(x,y) as the Manhattan distance between x and y.

For each point x in K-dimensional space, we can calculate a value d=max{yS|dis(x,y)}.

Your task is to find a point that have minimal d.

Note that the point doesn't need to be in S.

Input Format

The first line contains two integers N,K.

Each of the next N lines contains K integers. The j th integer in i th line is Si,j (Si,j means the j th dimension of Si1016Si,j1016).

Output Format

One line contains K real numbers. Each number should be in range [1018,1018].

We will calculate d using these values. Your answer will be considered correct if its relative or absolute error doesn't exceed 1010.

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

As dis((6,7),(3,4))=12, d can't be less than 6. Point (2,5) can also reach this limit.

Editor Image

?