Company: Tvs_6aug
Difficulty: medium
Wall Painting Combinations Problem Description A muralist has been commissioned to paint a wall inside a nature reserve, where local environmental rules restrict which paints may touch which parts of the wall. The wall is divided into N sections, and there are M paint types available. You are given a global list of which paint types are environmentally approved (1 for allowed, 0 for restricted), along with, for every section, the specific set of paint types that could physically be used there. Count how many ways the muralist can pick one paint for every section, using only paints that are both locally permitted for that section and globally approved, so that the whole wall gets painted. Input Format The first line contains an integer N represent the number of sections on the wall. The second line contains an integer M represent the number of paint types. The third line contains M space-separated integers where 1 means the paint type is allowed and 0 means it is restricted. The next N