cseshamim47's blog

By cseshamim47, history, 6 weeks ago, In English

Given a 2d array of N * M, find the max XOR of all elements of a sub-matrix. Problem Link.

N <= 10000 and M <= 20. Time limit: 1s. Memory limit: 256

I tried to go through all possible subarray [l...r] on M and calculated its xor. Then for each [l...r] I traversed all rows and then calculated the max xor of this [l...r]*Ni rectangle using trie.

When trie is implemented using struct I'm getting TLE. But, array implementation of trie is giving Accepted verdict. I don't understand what's the difference in time complexity. Isn't it the same?

TLE Solution
AC Solution

Also, I see that somebody has solved it without trie. How to solve it without trie?

Without TRIE solution
  • Vote: I like it
  • -3
  • Vote: I do not like it