Micro's House
Practice
3.8 (25 votes)
Approved
Data structures
Medium
Ready
Tries
Problem
84% Success 11967 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Our coder Micro, is building a new house. For that he bought a rectangular plot few days back. The plot is very big, so he decided that he will use some portion of the plot to make his house, and the rest he will use for playing cricket with his astrologer friend Mike. But Micro is very superstitious, he is not going to just randomly pick some portion to build his house. He want to maximize his good luck. For this he took help of Mike.
Mike divided the whole plot into grid of square blocks and assigned a Good Luck value to each. The size of the grid was N * M. For some unknown reasons Mike kept NM. Now he calculates the Good Luck value of a rectangular portion (rectangular sub matrix) as xor of Good Luck value of all square blocks in that rectangular portion. Help Micro in finding out the maximum Good Luck value he can achieve.

Input:
First line of a two space separated integers denoting N and M, (NM).
Following N lines contain M space separated integers denoting the Good Luck value of square blocks.

Output:
Print the maximum Good Luck value that Micro can achieve.

Constraints:
1≤N≤10000
1≤M≤20
1≤Good Luck value ≤10^8

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:30
44 votes
Tags:
MediumString ManipulationTreesTries
Points:30
10 votes
Tags:
TrieAdvanced Data StructuresData Structures
Points:30
17 votes
Tags:
Data StructuresMediumTries