Chandu and XOR
Practice
3.6 (162 votes)
Ready
Hiring
Approved
Easy
Problem
65% Success 2647 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Chandu is weak in maths. His teacher gave him homework to find maximum possible pair XOR in a matrix of size N x M with some conditions. Condition imposed is that, the pair can be formed between sum of elements in a column and sum of elements in a row.
See sample explanation for more details.

Input:
First line consists of two integers N, M.
Next N line contains M space separated integers denoting the value of matrix entry.

Output:
For each test case output a single integer denoting the max value of XOR according to the condition.

Constraints:
1 <= N, M <= 1000
1 <= Matrix[i][j] <= 10000

Note:
Expected time complexity of the solution should be less or equal to order of O(N * M).

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
12 votes
Tags:
MathematicsEasyNumber Theory
Points:20
Tags:
Easy
Points:20
1 votes
Tags:
Easy
Editorial

No editorial available for this problem.