10. Let $a_{1}, a_{2}, \cdots, a_{1999}$ be non-negative real numbers, and satisfy:
(1) $a_{1}+a_{2}+\cdots+a_{1999}=2$;
(2) $a_{1} a_{2}+a_{2} a_{5}+\cdots+a_{1998} a_{1999}+a_{1999} a_{1}=1$.

Let $S=a_{1}^{2}+a_{2}^{2}+\cdots+a_{1999}^{2}$, find the maximum and minimum values of $S$.
(12th Korean Mathematical Olympiad)
Solution: For $a_{1}+a_{2}+\cdots+a_{1999}=2$, the following calculation is made:
$$
\begin{array}{l}
f\left(a_{1}, a_{2}, \cdots, a_{1999}\right) \\
=a_{1} a_{2}+a_{2} a_{3}+\cdots+a_{1998} a_{1999}+a_{1999} a_{1}
\end{array}
$$

Find the maximum value.
Lemma: There exists an $i \in\{1,2, \cdots, 1999\}$, such that $a_{i}>a_{i+4}$ (with $a_{1999+i}=a_{i}$).
Proof: Otherwise, we have
$$
a_{1} \leqslant a_{5} \leqslant a_{9} \leqslant \cdots \leqslant a_{1997} \leqslant a_{2} \leqslant a_{6} \leqslant \cdots \leqslant a_{1998}
$$
$\leqslant a_{3} \leqslant a_{7} \leqslant \cdots \leqslant a_{1999} \leqslant a_{4} \leqslant a_{8} \leqslant \cdots \leqslant a_{1996} \leqslant a_{1}$,

Thus, $a_{1}=a_{2}=\cdots=a_{1999}=\frac{2}{1999}$, which does not meet the condition.
The lemma is proved.
Without loss of generality, assume $a_{1996}>a_{1}$.
For given $a_{1}, a_{2}, \cdots, a_{1996}, a_{1998}$, let
$$
\begin{array}{c}
a_{1}^{\prime}=a_{1}, a_{2}^{\prime}=a_{2}, \cdots, a_{1996}^{\prime}=a_{1996}, a_{1998}^{\prime}=a_{1998}, \\
a_{1999}^{\prime}=0, a_{1997}^{\prime}=a_{1997}+a_{1999},
\end{array}
$$

Then $\sum_{i} a_{i}^{\prime}=2$.
$$
\begin{array}{l} 
f\left(a_{1}^{\prime}, a_{2}^{\prime}, \cdots, a_{1999}^{\prime}\right) \\
= a_{1} a_{2}+a_{2} a_{3}+\cdots+a_{1995} a_{1996} \\
+a_{1996}\left(a_{1997}+a_{1999}\right)+\left(a_{1997}+a_{1999}\right) a_{1998} \\
= a_{1} a_{2}+\cdots+a_{1996} a_{1997}+a_{1996} a_{1999}+a_{1997} a_{1998} \\
\quad+a_{1998} a_{1999} \\
> a_{1} a_{2}+\cdots+a_{1998} a_{1999}+a_{1999} a_{1} \\
= f\left(a_{1}, a_{2}, \cdots, a_{1999}\right) .
\end{array}
$$

Next, let $a_{1}^{\prime \prime}=a_{1}^{\prime}, \cdots, a_{1996}^{\prime \prime}=a_{1996}^{\prime}+a_{1998}^{\prime}$, $a_{1997}^{\prime \prime}=a_{1997}^{\prime}, a_{1998}^{\prime \prime}=0$, then
$$
\begin{aligned}
f & \left(a_{1}^{\prime \prime}, a_{2}^{\prime \prime}, \cdots, a_{1998}^{\prime \prime}, 0\right) \\
= & f\left(a_{1}^{\prime}, a_{2}^{\prime}, \cdots, a_{1995}^{\prime},\left(a_{1996}^{\prime}+a_{1998}^{\prime}\right), a_{1997}^{\prime}, 0,0\right) \\
= & a_{1} a_{2}+\cdots+a_{1995} a_{1996}+a_{1995} a_{1998}+a_{1996} a_{1997}^{\prime} \\
& +a_{1997}^{\prime} a_{1998} \\
> & f\left(a_{1}^{\prime}, a_{2}^{\prime}, \cdots, a_{1998}^{\prime}, 0\right) .
\end{aligned}
$$

That is, each time the last non-zero number $a_{i}$ is set to zero, and the sum of $a_{i}$ and $a_{i-2}$ is set as the new $a_{i-2}$, the value of $f$ increases.
Until only three numbers remain:
$$
\begin{array}{l}
a_{1}+o_{2}+u_{3}=2 . \\
j\left(a_{1}, a_{2}, a_{3}, 0, \cdots, \hat{v}\right)=a_{1} a_{2}+a_{2} a_{3} \\
=a_{2}\left(2-a_{2}\right)=2 a_{2}-a_{2}^{2} \leqslant 1 .
\end{array}
$$

Thus, the maximum value of $f\left(a_{1}, a_{2}, \cdots, a_{1099}\right)$ is 1.
It is achieved when $a_{4}=a_{5}=\cdots=a_{1999}=0, a_{2}=1$. Therefore,
$$
\begin{aligned}
S & =a_{1}^{2}+a_{2}^{2}+a_{3}^{2}=1+a_{1}^{2}+a_{3}^{2} \\
& \geqslant 1+\frac{\left(a_{1}+a_{3}\right)^{2}}{2}=1 \frac{1}{2} .
\end{aligned}
$$

Hence, $S_{\min }=1 \frac{1}{2}$.
$$
\text { Also, } \begin{aligned}
S & =1+a_{1}^{2}+a_{3}^{2} \\
& =2\left(a_{1}-\frac{1}{2}\right)^{2}+\frac{3}{2}, 0 \leqslant a_{1} \leqslant 1,
\end{aligned}
$$

Therefore, $S_{\max }=2$.