• + 0 comments

    My Python3 version

    def solve(coordinates):
        X, Y = zip(*coordinates)
        max_X, min_X = max(X), min(X)
        max_Y, min_Y = max(Y), min(Y)
        absminX, absminY = abs(min_X), abs(min_Y)
        rangeX = max_X - min_X
        rangeY = max_Y - min_Y
        max_range = max(rangeX, rangeY)
        if max_range > max([absminX, max_X, max_Y, absminY]):
            return float('{0:.12f}'.format(max_range))
        distance = (max(max_X, absminX)**2 + max(max_Y, absminY)**2) ** 0.5
        return float('{0:.12f}'.format(distance))