How to solve this dp+bitmasking problem?

how to solve this problem?
https://codeforces.com/gym/102348/problem/C
any other approach without dp with bitmasking?

2 Likes