[백준] 1012 유기농 배추 - C++
https://www.acmicpc.net/problem/1012 문제 설명 문제 풀이 #include #include #include using namespace std; int map[50][50]; int nx[4] = {-1, 1, 0, 0}, ny[4] = {0, 0, -1, 1}; int M, N, K; void bfs(int a, int b) { int x, y; pair t; queue q; q.push(make_pair(a, b)); map[a][b] = 0; while(!q.empty()) { t = q.front(); q.pop(); for(int i = 0; i < 4; i++) { x = t.first + nx[i]; y = t.second + ny[i]; if(x < 0 || x..
2023. 8. 1.