Company: amdocs_1april
Difficulty: medium
Bobby has a paper tape with n cells in a row on it. As he thinks the blank paper tape is too dull, he wants to paint these cells with m kinds of colors. For some aesthetic reasons, he thinks that the i-th color must be used exactly a[i] times, and for every k consecutive cells, their colors have to be distinct. Help Bobby to figure out if there is a way to paint the cells. Return 1 if yes and 0 otherwise. Example: n = 12 m = 6 k = 2 a = 2,2,2,2,2,2 We can color the cells as follows: (1,2,1,2,3,4,3,4,5,6,5,6). For any 2 consecutive cells, their colors are distinct.