Tasks:
 
Task DescriptionDiscussion (0)
Task :: z-matrix
Little Z has found nxm matrix A filed with integers. He wants to erase all numbers in exactly two rows and two columns in order to get maximum possible multiplication of the rest of the numbers.

INPUT:
The first line of the standard input contains two space-separated cardinals n and m (3 <= n, m <= 30). In each of the next n lines are listed m space-separated integers. j-th integer in i-th line represents number at i-th row and j-th column of the matrix A. All integers are from interval [-1000, 1000].

OUTPUT:
On the standard output you should print 4 integers that represent 1-based sorted indices of rows and columns that Little Z should erase. In there are more solutions, print the first lexicographically.

Input:
3 4
1 1 2 2
3 3 4 4
5 5 5 5

Output:
1 1 2 2


Explanation:
Erasing 1st row and column and 2nd row and column will leave us with product 5 * 5 = 25.
Note that indices are not printed in order (row, column), but in sorted order. Also, we could erase, i.e., 2nd and 4th column and get the same product, but it will lead to lexicographically greater output.

Input:
4 5
0 -2 1 6 200
13 18 20 -11 22
1 4 2 9 2
9 8 0 0 -1

Output:
1 3 3 4


Explanation:
Erase 3rd and 4th row and 1st and 3rd column.
Submit Solution
:
:
Available Languages
Task info
Name:z-matrix
Time:1 sec.
Memory:16 MB
#Tests:25
AddedBy: boba5551
Source:Slobodan Mitrović
Task Ratings
Difficulty:

4.6 (7 votes)
Quality:

4.7 (6 votes)
Acceptance Rate
Recent Submissions
Fastest Solutions
UserTime
Daniel93 0.09 s.
gates 0.18 s.
RobertGerbicz 0.21 s.
halil 0.375 s.
tjhance 0.47 s.
Amtrix 0.52 s.
neal_wu 1.1 s.
dimke 1.19 s.
Chmel_Tolstiy 1.32 s.
1010011010 1.425 s.
Solved By