Hello respected coders , please tell me approach to solve this at coder question LOGICAL FILLING firstly i was thinking that this question was dp but atleast we need two states for dp and that will be a TLE , how to approach this please help , and 4th question of atcoder is a barrier for me how to cross that .
HELP








