Bitmask Dp + Game theory leetcode problem

Hello Codechef Community , I have encountered a really good problem on leetcode related to Game theory and Bitmask DP .

If there is anyone who is comfortable in this topic and ca help me out , it will really a great help .

30 / 57 test cases passed

It is failing on test case 18 79

The link of the problem is : - LeetCode
My solution link is : class Solution {public: map<pair<int ,int> , int>dp; -

A little bit about my approach : Basically , I am waiting for a particular state where no matter what number opponent chose , I will still be able to win . So if the opponent is unable to win no matter what number he choses , then I will definitely win . For that I have taken a mask of (1<<20) and totalSum in my dp state .