The tests for this problem consist of five groups. Points for each group are awarded only if all tests in the group and all tests in some of the previous groups are passed. Note that passing the tests from the statement is not required for some groups. The final score for each group is the maximum score obtained for that group of tests across all submitted solutions.

\medskip
\begin{center}
\small
\begingroup
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
& & \multicolumn{2}{c|}{Additional constraints} & & \\
\cline{3-4}
\raisebox{2.25ex}[0cm][0cm]{Group}
& \raisebox{2.25ex}[0cm][0cm]{Points}
& $n$ & $q$
& \raisebox{2.25ex}[0cm][0cm]{{\centering Required groups}}
& \raisebox{2.25ex}[0cm][0cm]{Comment}
\\
\hline
0 & 0 & -- & -- & -- & Tests from the statement. \\
\hline
1 & 15 & $n \leq 1000$  & $q \leq 1000$ & 0 &  \\
\hline
2 & 22 & --  & -- & -- &  $b_i = b_j$ for all $1 \leq i, j \leq q$ \\
\hline
3 & 26 & --  & -- & -- & $b_i \leq 2$ for all $1 \leq i \leq q$ \\
\hline
4 & 16 & --  & -- & -- & $p_i = i$ for all $1 \leq i \leq n$ \\
\hline
5 & 21 & --  & -- & 0 -- 4 &  \\
\hline
\end{tabular}
\endgroup
\end{center}