Inaho XI

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Given M points in N dimensional space, find the minimum "surface area" of a hyperrectangle required to contain all M points modulo 109+7.

As an example, the "surface area" of a 2-dimensional hyperrectangle (rectangle) is the sum of its 4 side lengths. The "surface area" of a 3-dimensional hyperrectangle (rectangular prism) is the sum of the areas of the 6 sides of the hyperrectangle.

Input Specification

The first line will contain two space-separated integers, N,M (2N10,1M105), the number of dimensions and the number of points respectively.

The next M lines will each contain N integers, ai1,ai2,,aiN (109aij109).

Output Specification

Output the minimum "surface area" of a hyperrectangle required to contain all M points, modulo 109+7.

Subtasks

Subtask 1 [10%]

N=2

M100

Subtask 2 [20%]

M100

Subtask 3 [70%]

No additional constraints.

Sample Input 1

Copy
2 4
1 1
3 3
-1 2
0 0

Sample Output 1

Copy
14

Sample Input 2

Copy
5 3
1 4 2 3 4
0 -129 6 9 0
0 0 -10 9 5

Sample Output 2

Copy
183436

Comments

There are no comments at the moment.