행렬의 영역

    NHN 2020 pre-test 1차 모의고사 - 행렬의 영역(c++)

    풀이 #include #include #include using namespace std; int BFS(int x, int y, int sizeOfMatrix, int **matrix, bool **visit){ if(!matrix[x][y] || visit[x][y]) return -1; int count = 1; queue q; q.push( make_pair(x, y) ); visit[x][y] = true; int dx[] = {1,-1,0,0}; int dy[] = {0,0,1,-1}; while(!q.empty()){ int sx = q.front().first; int sy = q.front().second; q.pop(); for(int i=0; i=0 && ny>=0 &&..