class Solution {
public:
vector<vector<int>> flipAndInvertImage(vector<vector<int>>& A) {
int m = A.size();
int n = A[0].size();
// cout<<m<<n<<endl;
for(int i = 0;i<m;i++)
{
for(int j = 0;j<n/2;j++)
{
int tmp = A[i][j];
A[i][j] = 1-A[i][n-j-1];
A[i][n-j-1] = 1-tmp;
}
if(n%2==1)A[i][n/2] = 1- A[i][n/2];
}
return A;
}
};