Write $n^2$ real numbers into $n \times n$ square grid

This can be done so that all rows are the same. Here's the idea of my solution: let the first column all have a value of $a > 0$, to be chosen later. Let the next $k - 1$ columns all have $-1$ in them. Then repeat this pattern: one column of $a$'s, $k-1$ column's of $-1$'s. Then every $k \times k$ square has exactly one column of $a$'s and the rest are $-1$'s. Thus, the sum over this square is $ ka - k(k-1)$. If we want this value to be negative, then we need $a < k - 1$, i.e. $a = k-1 - \epsilon$ for some $\epsilon > 0$, to be decided later.

Now let's look at the sum over the whole matrix. If we write $n = mk + r$, then we have $m$ columns of $a$'s and $n - m$ columns of $-1$'s. The total sum is then $$ nma - (n - m)n$.

Note that $n = mk + r \implies n - m = m(k - 1) + r$. Thus, we have that the sum over the whole matrix is $$ nm((k - 1) - \epsilon) - ((k - 1)m - r)n = rn - nm\epsilon.$$

Thus, if we take $\epsilon = \frac{r}{2m}$, then we have that the sum is $$ rn - nm\epsilon = rn - nm \frac{r}{2m} = \frac{rn}{2} > 0$$ as desired.

EDIT: The final matrix looks like: $$ \left(\begin{array}{cccc|cccc|c|ccc} a& -1 & \cdots & -1 &a & -1 & \cdots & -1 &\cdots &a & \cdots & -1 \\ a& -1 & \cdots & -1 &a & -1 & \cdots & -1 &\cdots &a & \cdots & -1 \\ \vdots& \vdots & \ddots & \vdots & \vdots & \vdots & \ddots & \vdots &\ddots &\vdots & \ddots & \vdots \\ a& -1 & \cdots & -1 &a & -1 & \cdots & -1 &\cdots &a & \cdots & -1 \\ \end{array} \right)$$

Where $a = k-1 -\frac{r}{2m}$ in each block but the last I have one column of $a$'s and $(k-1)$ columns of $-1$'s. In the last column, I have $r$ $-1$'s. note, if I multiply the whole matrix by $2m$, then it has integer entries.


Here's an answer to show that in fact the OP's original idea works, if the numbers are chosen correctly.

Let our matrix take values $b-a$ at indexes $(ik,jk)$ and $b$ elsewhere, with $n$ factored as $n=mk+r$. Then the sum across a $k\times k$ submatrix is $k^2b-a$, and the sum across the whole $n\times n$ matrix is $n^2b-m^2a$. The constraints to satisfy are thus $n^2b>m^2a$ and $k^2b<a$. This implies $m^2k^2b<m^2a<n^2b$, so $mk<n$ implies $b>0$. Dividing through by $m^2b$, we get

$$k^2<\frac ab<\frac{n^2}{m^2},$$

and we can feel free to choose $b=2m^2$ and $a=n^2+m^2k^2$ (the midpoint) or any other solution which satisfies the inequality. The OP's choice used $b=1$ and $a=k^2+1$, which satisfies the first inequality, but the second inequality in the worst case has $r=1$ so $\frac nm=k+\frac1m$ and $\frac{n^2}{m^2}=k^2+2\frac km+\frac1{m^2}$, so the $+1$ is a bit too generous and is undercut for large $m$. (This can also be taken as a proof that a sufficiently large integer solution cannot take $1$ for the "background" value $b$.)