```
int a[9];
class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
memset(a,0,sizeof(a));
for (int i=0,j=0,row=0,col=0;i<9;++j,j==9?++i,j=0,row=col=0:0)
{
if (board[i][j]!='.')
{
if ((1<<board[i][j]-48) & row) return false;
else row|=1<<board[i][j]-48;
if ((1<<board[i][j]-48) & a[i/3*3+j/3]) return false;
else a[i/3*3+j/3]|=1<<board[i][j]-48;
}
if (board[j][i]!='.')
if ((1<<board[j][i]-48) & col) return false;
else col|=1<<board[j][i]-48;
}
return true;
}
};
```