2583
[실1] 2583 - 영역 구하기 bfs
#include #include #include #include #include using namespace std; using int_pair = pair; #define SIZE 1000 #define x first #define y second // 상 하 좌 우 int_pair arr_pos[] { {0, 1}, {0,-1}, {-1,0}, {1, 0} }; queue q; bool graph[SIZE][SIZE]{ false }; int zone = 0; // w:넓이, h:높이, k:테스트 개수 int w, h, k; int BFS() { int block_cnt = 0; while (!q.empty()) { auto front = q.front(); q.pop(); for (int i = 0..