[백준 1012] 유기농 배추
·
Programming/PS
문제https://www.acmicpc.net/problem/1012코드#include using namespace std;int matrix[50][50];int T, M, N, K, X, Y;int cnt = 0;queue> q;int dy[4] = { -1, 1, 0, 0 };int dx[4] = { 0, 0, -1, 1 };void BFS() { while (!q.empty()) { pair front = q.front(); q.pop(); for (int i = 0; i = M || newY = N) continue; if (matrix[newY][newX] != 1) continue; matrix[newY][newX] = 0; // 방문 처리 q.push(make_pair(new..