O(n2), solution and got TLE, can someone help me?

vector row;
vector col;
for(int i=0; i<A.size(); i++)
{
for(int j=0; j<A[i].size(); j++)
{
if(A[i][j]==0)
{
row.push_back(i);
col.push_back(j);
}
}
}
unique(row.begin(), row.end());
unique(col.begin(), col.end());
for(int i=0; i<row.size(); i++)
{
for(int j=0; j<A[row[i]].size(); j++)
{
A[row[i]][j]=0;
}
}
for(int i=0; i<col.size(); i++)
{
for(int j=0; j<A.size(); j++)
{
A[j][col[i]]=0;
}
}

use set instead of a vector, and use insert()( duplicates never inserted, no need of unique).

Click here to start solving coding interview questions