Check for every type. If all checks pass, all required pieces are available; otherwise the failing type is insufficient. Time is and storing the arrays takes space. The naive implementation counts deficient types and also passes the full constraints.
Solution written by GPT6