Suppose that $m \ge 1$ is a given positive integer, and $n \ge 1$ is a given even integer.
Let $R$ be the set of vectors $\vec{r} = (r_1, r_2, \cdots, r_n)$ such that
- every coordinate $r_i$ is a non-negative integer,
- $r_i + r_{i+1} = m$ for odd indices $i = 1, 3, \cdots, n-1$, and
- $r_i + r_{i+1} \le m$ for even indices $i = 2, 4, \cdots, n-2$.
For $\vec{r}= (r_1, r_2, \dots, r_n) \in R$, let $$f(\vec{r}) = (r_1^2 + r_2^2 + \cdots + r_n^2) + (r_1r_2 + r_2r_3 + \cdots + r_{n-1} r_n)$$
I'm interested in giving a concise description of the set $$M := \{ \vec{r} \mid \vec{r} \text{ minimizes } f \text{ over } R \}.$$ Here is one possible characterization that I would be happy with, if true. Let $$g(\vec{r}) = (m-r_1)^2 + (m-r_2-r_3)^2 + \cdots + (m-r_{n-2}+r_{n-1})^2 + (m-r_n)^2.$$ If $$M' = \{ \vec{r} \mid \vec{r} \text{ minimizes } g \text{ over } R \},$$ is it true that $M=M'$?
If so, then I think we are done. The terms $m-r_1$, $m-r_2-r_3$, …, $m-r_n$ have constant sum of $m$ by the assumptions on vectors in $R$. So the sum of their squares is minimized by making the terms as equal as possible. In other words, each of the terms $m-r_1$, $m-r_2-r_3$, …, $m-r_n$ should be either equal to $$\left\lfloor\frac{m}{n/2 +1} \right\rfloor \text{ or } \left\lceil \frac{m}{n/2 +1} \right\rceil.$$ Thus it is possible to quickly compute $M'$.
One example is the following. If $m=10$ and $n=6$, there are six vectors in $M$.
- $(7, 3, 4, 6, 2, 8)$
- $(7, 3, 5, 5, 2, 8)$
- $(7, 3, 5, 5, 3, 7)$
- $(8, 2, 5, 5, 2, 8)$
- $(8, 2, 5, 5, 3, 7)$
- $(8, 2, 6, 4, 3, 7)$
The minimum of $f$ is attained only when $$r_{2i}=i\ \bigg|\bigg|\frac{2m}{n+2}\bigg|\bigg|,\qquad r_{2i-1}=m-i\ \bigg|\bigg|\frac{2m}{n+2}\bigg|\bigg|\qquad\bigg(i=1,2,\cdots, \frac n2\bigg)$$ where $|| x ||$ represents the nearest integer to $x$.
Proof :
$f$ can be simplified as $$\begin{align}f&=\left( r_1^2 + r_2^2 + \dots + r_n^2 \right) + \left(r_1r_2 + r_2r_3 + \cdots +r_{n-1} r_n \right) \\\\&=(r_1+r_2)^2+(r_3+r_4)^2+\cdots +(r_{n-1}+r_n)^2 \\&\qquad -r_1r_2-r_3r_4-\cdots -r_{n-1}r_n \\&\qquad +r_2r_3+r_4r_5+\cdots +r_{n-2}r_{n-1} \\\\&=\frac n2m^2-r_1r_2-r_3r_4-\cdots -r_{n-1}r_n \\&\qquad +r_2r_3+r_4r_5+\cdots +r_{n-2}r_{n-1} \\\\&=\frac n2m^2-(m-r_2)r_2-(m-r_4)r_4-\cdots -(m-r_n)r_n \\&\qquad +r_2(m-r_4)+r_4(m-r_6)+\cdots +r_{n-2}(m-r_n) \\\\&=\frac n2m^2+r_2^2+r_4^2+\cdots +r_n^2 \\&\qquad -mr_n-r_2r_4-r_4r_6-\cdots -r_{n-2}r_n\tag1\end{align}$$
We want to minimize $(1)$ under the condition that $$0\le r_2\le r_4\le \cdots \le r_n\le m\tag2$$
(This is because $r_{2i}+r_{2i+1}\le m\iff r_{2i}+(m-r_{2i+2})\le m\iff r_{2i}\le r_{2i+2}$.)
We have $\dfrac{\partial f}{\partial r_{2i}}=2r_{2i}-r_{2i-2}-r_{2i+2}\ (i=1,2,\cdots, \frac n2)$ where $r_{0}=0, r_{n+2}=m$.
Solving $\dfrac{\partial f}{\partial r_{2i}}=2r_{2i}-r_{2i-2}-r_{2i+2}=0$ gives $r_{2i}=ir_2\ (i=2,3,\cdots, \frac n2)$ and $r_2=\frac{2m}{n+2}$. Since $r_2$ has to be an integer, $r_2$ has to be $||\frac{2m}{n+2}||$. These satisfy $(2)$.
Therefore, we can say that the minimum of $f$ is attained only when $$r_{2i}=i\ \bigg|\bigg|\frac{2m}{n+2}\bigg|\bigg|,\qquad r_{2i-1}=m-i\ \bigg|\bigg|\frac{2m}{n+2}\bigg|\bigg|\qquad\bigg(i=1,2,\cdots, \frac n2\bigg).\ \blacksquare$$
Added :
It is true that $M=M'$.
Proof :
We have $$g=2f-nm^2+m^2\tag3$$ since $$\begin{align}g&=(m-r_1)^2 + (m-r_2-r_3)^2 + \cdots + (m-r_{n-2}-r_{n-1})^2 + (m-r_n)^2 \\\\&=(m-(m-r_2))^2+(m-r_2-(m-r_4))^2 \\&\qquad +\cdots +(m-r_{n-2}-(m-r_n))^2+(m-r_n)^2 \\\\&=r_2^2+(r_4-r_2)^2+\cdots +(r_n-r_{n-2})^2+(m-r_n)^2 \\\\&=2(r_2^2+r_4^2+\cdots +r_n^2)-2mr_n \\&\qquad -2r_2r_4-2r_4r_6-\cdots -2r_{n-2}r_n+m^2 \\\\&=2(r_2^2+r_4^2+\cdots +r_n^2-mr_n-r_2r_4-r_4r_6-\cdots -r_{n-2}r_n)+m^2 \\\\&=2\bigg(f-\frac n2m^2\bigg)+m^2 \\\\&=2f-nm^2+m^2\end{align}$$
So, it follows from $(3)$ that $M=M'$.$\ \blacksquare$