Let $A$ be a $n\times n$ matrix with coefficients from the set $\{-1,0,1\}$. Let $r_i$ and $c_i$ denote the sum of the elements of the $i$-th row and column of $A$ respectively. For which $n$ is it possible that the numbers $r_1,...,r_n,c_1,...,c_n$ be different pairwise?
If $n$ is even, I am able to construct such a matrix, which I call $A_n$. $$ A_2=\begin{pmatrix}1&1\\-1&0\end{pmatrix}\\ A_4=\begin{pmatrix}1&1&1&1\\-1&1&1&1\\-1&-1&0&1\\-1&-1&-1&0\end{pmatrix}\\ A_{n+2}=\begin{pmatrix}1& \begin{matrix}1&\cdots&1\end{matrix} &1\\ \begin{matrix}-1\\\vdots\\-1\end{matrix} &A_n&\begin{matrix}1\\\vdots\\1\end{matrix}\\-1&\begin{matrix}-1&\cdots&-1\end{matrix}&0\end{pmatrix} $$
Not hard to check that these matrices have all different line (row or column) sums.
However, if $n$ is odd, it seems impossible to construct such a matrix. I'd like to prove that if $n$ is odd, any $n\times n$ matrix with coefficients from the set $\{-1,0,1\}$ has two lines with the same sum of elements. Any ideas on how to proceed?
I know this is a belated answer, but here's a proof in French: https://oeis.org/A049475/a049475.pdf#page=4
Luca shows that such matrices exist when $n$ is even. We show that such matrices exist only when $n$ is even by showing that number of rows with strictly positive sums must be exactly $\frac{n}{2}$ or number of rows with strictly negative sums must be exactly $\frac{n}{2}$ (so for odd $n$, $\frac{n}{2}$ is not an integer).
Note that there are possibly $2n+1$ different sums in total (from $-n$ to $n$), while we have $n$ rows and $n$ columns, so we require $2n$ different sums. There is exactly one sum is missing. Assume the missing sum is $X$. WLOG assume $X\le 0$ because otherwise we can negate all elements in the matrix. So we have $-n\le X\le 0$. In this way, we can see that we have exactly $N$ rows or columns with strictly positive sums, and also exactly $N$ rows or columns with non-positive sums.
By rearranging rows and columns, we can let first several rows have all strictly positive sums, following by rows with non-positive sums. Assume we have $r$ rows with positive sums, $s$ rows with non-positive sums. Similarly, let first several columns have all strictly positive sums (assume we have $p$ columns), followed by $q$ columns with non-positive sums. Let $x$ be the sum of $pr$ elements on the top left corner (i.e. intersection of rows with strictly positive sum and columns with strictly negative sum, same follows). Let $u$ be the sum of $qr$ elements on top right corner; let $v$ be the sum of $ps$ elements on bottom left corner; let $y$ be the sum of $qs$ elements on bottom right corner.
Let $A$ be the row and column sums of all strictly positive rows and columns (so it's a sum of $p + r$ rows and columns). We have $A = 2x + u + v$. Also since all strictly positive sums appear exactly once, we have $A = \frac{n(n+1)}{2}$. Similarly, let $B$ the row and column sums of all non-positive rows and columns. We have $B = 2y + u + v = -\frac{n(n+1)}{2} - X$. So $A - B = 2(x-y) = n(n+1) + X$.
From definition, we have $p+q = n$ (because matrix has exactly $n$ rows) and $p+r = n$ (because all strictly positive row or column sums appear exactly once), and similarly $r+s = q + r = n$. So $p=s$ and $q=r$. Note that all elements are -1, 0, 1, so we have $|x|\le pr = pq$ and $|y|\le qs = pq$. So $2(x-y)\le 4pq$.
Since $n(n+1)+X = 2(x-y)$, we have $n(n+1)+X\le 4pq$. Also $n = p+q$, we have $$n+X\le 4pq-N^2=4pq-(p+q)^2=-(p-q)^2\le 0$$. Note that $-n\le X\le 0$ because it's a non-positive missing sum, we have $n+X\ge 0$. Therefore we know $X = -n$ (i.e. the missing sum must be $-n$) and $p=q$ (i.e. umber of rows with strictly positive sums must be exactly $\frac{n}{2}$).