Fill a partially filled matrix such that xor of 4 corner elements of all its sub matrices is 0 [closed]

牧云@^-^@ 提交于 2020-04-07 10:39:08

问题


The problem is:

Given a matrix of dimensions N*M with only K cells filled. You are required to fill rest of the cells with values ranging from 0 to 2^30-1 such that:

  1. the xor of the 4 corner cell elements equals 0.
  2. (1) is satisfied by every sub-matrix of dimensions p*q where p>1 and q>1.

What I could think about it was given any unfilled cell I can check if it is a corner element for any sub-matrix for which other three corners are filled. For all other cases we can work with cases: one of the unfilled cells can take any value and we see how many ways can the other unfilled cells be filled by processing the same thing above.

I am not even sure if this works, and even if it works the time complexity should be very high. What efficient solutions are available for this question?

来源:https://stackoverflow.com/questions/61062518/fill-a-partially-filled-matrix-such-that-xor-of-4-corner-elements-of-all-its-sub

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!