By using the Euler characteristic $\chi = L-E+V$ of the graph $\Gamma$ corresponding to the polyhedron (each cube is a vertex and we link adjacent cubes). One can show that $$ S = 4N - 2L + 2\chi $$ where $S$ is the total area of the uncovered faces, $N$ the number of cubes and $L$ the number of loops in $\Gamma$.
This gives a constraint on the possible $A(P)$. For example $A(P)=1^n 2^n 3^n \dots p^n$ can only be achieved if $4\mid np(p+1)$. In the case $n=1$, a golyhedron is only possible if $p \equiv 0,3 \:\mathrm{mod}\: 4$.