The first example is explained in the legend above.

In the second example, for instance, it is possible to divide into the following segments: $[1;6]$, $[7;9]$, $[10;10]$.

In the first segment, the teams can be formed as $[1,4]$, $[2,3,5]$ --- $1$ and $4$ do not conflict with each other, as well as the pairs $(2;3)$, $(2;5)$, $(3;5)$.

In the second segment, the teams can be formed as $[1,3]$, $[2,4,5]$ --- $1$ and $3$ do not conflict with each other, as well as the pairs $(2;4)$, $(2;5)$, $(4;5)$.

In the third segment, the teams can be formed as $[1,2]$, $[3,4,5]$ --- $1$ and $2$ do not conflict with each other, as well as the pairs $(3;4)$, $(3;5)$, $(4;5)$.