CERSOL doubt


#1

I thought that this question could be done with graph coloring and then adding the present classes which weren’t assigned any color?

Question: Link

My Attempt: Link

Where did I go wrong?


#2

The hints have been posted in my Codeforces blog here