Let $w$ denote an $mn$-bit word (i.e. a binary word of length $mn$). Assuming that $b_{i,j}$ denote individual bits, we can represent $w$ in the “rectangular” form as follows:
$$\begin{array}{l} b_{1.1}b_{1.2} \ldots b_{1.(m-1)}b_{1.m}\\ b_{2.1}b_{2.2} \ldots b_{2.(m-1)}b_{2.m}\\ \ldots\\ b_{(n-1).1}b_{(n-1).2} \ldots b_{(n-1).(m-1)}b_{(n-1).m}\\ b_{n.1}b_{n.2} \ldots b_{n.(m-1)}b_{n.m}. \end{array}$$
Then $$H_{i,m}(w) = b_{i.1}b_{i.2} \ldots b_{i.(m-1)}b_{i.m}$$ are $m$-bit horizontal subwords of $w$ (for $1 \leq i \leq n$) and $$V_{n,i}(w) = b_{1.i}b_{2.i} \ldots b_{(n-1).i}b_{n.i}.$$ are $n$-bit vertical subwords of $w$ (for $1 \leq i \leq m$).
Given a pair of arbitrary (see note 1 below) integers $(m, n),$ I am interested in an efficient algorithm that allows to construct an example of an $mn$-bit word $W$ that satisfies all of the following five properties:
- All $m$-bit horizontal subwords of $W$ are different from each other;
- All $n$-bit vertical subwords of $W$ are different from each other;
- Any $m$-bit horizontal subword of $W$ is different from any $n$-bit vertical subword of $W$, i.e. there does not exist an $m$-bit horizontal subword of $W$ that is equal to some $n$-bit vertical subword of $W$ (this property is automatically satisfied if $m \neq n$);
- The number of non-zero bits in any $m$-bit horizontal subword of $W$ is equal to $m/2$;
- The number of non-zero bits in any $n$-bit vertical subword of $W$ is equal to $n/2$.
Is it possible to solve this problem?
Note 1.
Obviously, both $m$ and $n$ must be even and such that $m \leq \binom{n}{n/2}, n \leq \binom{m}{m/2}.$ Maybe there are some other requirements for $(m, n).$ For example, if $m=8, n=8,$ does there exist a $64$-bit word $W_{64}$ satisfying the above conditions?
1111000001011100001100111100100100001111001101011100011010101010
$\endgroup$