Well optimised program, beats 100% in runtime and memory, using 2d dp.
Intuition\n1 Precompute Shortest Distances Using BFS, store in moves.(note: added the initial knight position at the begining of positions array).\n2 Recursive 
# Intuition\n1 Precompute Shortest Distances Using BFS, store in moves<pawn_index, pawn_index>.(note: added the initial knight position at the begining of positions array).\n2 Recursive DP Function. DP<bitmask, current_position>.(as current position stores the information of how many pawns are killed implies it stores the information of whose turn it is. So no need to add another dimension of whose turn it is).\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int helper(vector<vector<int>>& dp, int ind, vector<vector<int>>& moves, int curr, int n, int turn)\n    {\n        if(curr == ((1<<n) - 1))\n            return 0;\n        if(dp[curr][ind] != -1)\n            return dp[curr][ind];\n\n        if(turn)\n            dp[curr][ind] = INT_MAX;\n        for(int i=1; i<n; i++)\n        {\n            if(curr&(1<<i))\n                continue;\n            if(!turn)\n                dp[curr][ind] = max(dp[curr][ind], moves[i][ind] + helper(dp, i, moves, (curr|(1<<i)), n, !turn));\n            else\n                dp[curr][ind] = min(dp[curr][ind], moves[i][ind] + helper(dp, i, moves, (curr|(1<<i)), n, !turn));\n        }\n        return dp[curr][ind];\n    }\n    \n    int maxMoves(int kx, int ky, vector<vector<int>>& p) {\n        p.insert(p.begin(), {kx, ky});\n        int n = p.size();\n        map<pair<int,int>, int> mp;\n        for(int i=0; i<n; i++)\n            mp[{p[i][0], p[i][1]}] = i;\n\n        vector<vector<int>> moves(n, vector<int>(n, 0));\n        int dir[8][2] = {{2,1}, {1,2}, {2,-1}, {1,-2}, {-2,1}, {-1,2}, {-2,-1}, {-1,-2}};\n        for(int i=0; i<n-1; i++)\n        {\n            vector<vector<bool>> v(50, vector<bool> (50));\n            queue<pair<pair<int, int>, int>> q;\n            q.push({{p[i][0], p[i][1]},0});\n            v[p[i][0]][p[i][1]] = true;\n\n            int count = i;\n            while(!q.empty() && count < n-1)\n            {\n                auto [x, y] = q.front().first;\n                int dis = q.front().second;\n                q.pop();\n                for(int j=0; j<8; j++)\n                {\n                    int nx = x+dir[j][0], ny = y+dir[j][1];\n                    if(!(nx < 50 && nx > -1 && ny < 50 && ny > -1 && !v[nx][ny]))\n                        continue;\n                    q.push({{nx, ny}, dis+1});\n                    v[nx][ny] = true;\n                    if(!(mp.find({nx, ny}) != mp.end() && moves[i][mp[{nx, ny}]] == 0))\n                        continue;\n                    count ++;\n                    moves[i][mp[{nx, ny}]] = dis+1;\n                    moves[mp[{nx, ny}]][i] = dis+1;\n                }\n            }\n        }\n        vector<vector<int>> dp(1<<n, vector<int>(n,-1));\n        return helper(dp, 0, moves, 1, n, 0);\n    }\n};\n```
['Dynamic Programming', 'Breadth-First Search', 'Bitmask', 'C++']