Intuition and Approach are commented in Code..
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\n//Good bit Mask question in why we are using bitmask because we need to keep the track \n//of the wchich row we had taken and the no of row maximimum is 10 so we only requrire 10 bits\n//and it will not give MLE and we need the maximum score so we tries to take the maximum one first\n//thts why we have to start from the maximum value..\nprivate:\n    int maxPoints(int n,vector<vector<int>>& dp,vector<int> count[],int mask){\n        if(n == 0)return 0;\n\n        if(dp[n][mask] != -1) return dp[n][mask];\n\n        int ans=maxPoints(n-1,dp,count,mask);//this means we are skipping this number\n        //and we are going for the next number\n\n        for(auto it:count[n]){\n            if((mask & (1 << it) ) ) continue;//it is ensuring this we had not taken this row previously\n            //because if it is taken then its value should be one and we are not able to take this row...\n            ans=max(ans,n + maxPoints(n-1,dp,count,mask | (1 << it)));//if i am going to tkae this row then i am \n            //going to mark this bit so that further no one can able to take this row again..\n\n        }\n        return dp[n][mask]=ans;\n    }\npublic:\n    int maxScore(vector<vector<int>>& grid) {\n        int n=grid.size();\n        int m=grid[0].size();\n        //here we setting the size of the dp matirx like this because the maximum number is 100 and the number\n        //of possible rows is (n) so the totla bits needed to represent the (n) rows we needed to take the \n        //number (2^n) which will keep the track of which row has taken previously..\n        vector<vector<int>> dp(101,vector<int>(1<<n,-1));\n        //here we are storing the frequency of any number in which row it is present..\n        vector<int> count[101];\n        int maxi=0;\n        for(int i=0;i<n;i++){\n            for(int j=0;j<m;j++){\n                //this means in which row this value is present.\n                count[grid[i][j]].push_back(i);\n                maxi=max(maxi,grid[i][j]);\n            }\n        }\n        //it is meant that i hava options from where to take the number and what are the\n        //previous rows i had taken in the starting we have the option to pick the maximum value\n        //and till now we had not taken any row so the mask value is 0.\n        //here we had to remember what are the previous values we had taken we are doing thos \n        //the bitmask....\n        return maxPoints(maxi,dp,count,0);\n\n    }\n};\n```
['Array', 'Dynamic Programming', 'Bit Manipulation', 'Matrix', 'Bitmask', 'C++']