Dp with bitmask, SPOJ SOCOLA problem

I am not able to understand what state should I take in my dp for this question ?
Someone please help me in solving this.
https://www.spoj.com/problems/SOCOLA/ .