[guided]The key idea is that an integer $n \neq 0$ whose prime factors lie in $\{p_1, \ldots, p_r\}$ is a perfect square if and only if the exponent of every $p_i$ in its prime factorisation is even, and $n > 0$. To detect squareness, we therefore only need to track $r + 1$ bits per integer: the sign, plus the parity of each exponent.
Concretely, for any nonempty $J \subseteq \{1, \ldots, k\}$ we form the product $c_J := \prod_{i \in J} c_i$, which is a nonzero integer with prime factors in $\{p_1, \ldots, p_r\}$. By unique factorisation in $\mathbb{Z}$, we may write
\begin{align*}
c_J = (-1)^{\alpha_{J,0}} \, p_1^{\alpha_{J,1}} \cdots p_r^{\alpha_{J,r}} \, m_J^2,
\end{align*}
where $\alpha_{J,0} \in \{0,1\}$ is the sign bit, each $\alpha_{J,i} \in \{0,1\}$ is the parity of the exponent of $p_i$ in $c_J$, and $m_J \geq 1$ absorbs all even contributions. This decomposition is unique: $\alpha_{J,0}$ is determined by $\operatorname{sgn}(c_J)$, and each $\alpha_{J,i}$ is the reduction of the $p_i$-adic valuation $v_{p_i}(c_J)$ modulo $2$.
The parity signature of $J$ is the vector
\begin{align*}
\sigma(J) := (\alpha_{J,0}, \alpha_{J,1}, \ldots, \alpha_{J,r}) \in \{0,1\}^{r+1}.
\end{align*}
By construction, $c_J$ is a perfect square if and only if $\sigma(J) = (0, 0, \ldots, 0)$.[/guided]