[백준 2468번] 안전영역 (C++)
문제링크 : https://www.acmicpc.net/problem/2468 #include using namespace std; int arr[102][102]; bool check[102][102]; int n,cnt, mh=-1; int result = 0; int dx[] = { -1,1,0,0 }; int dy[] = { 0,0,-1,1 }; queueq; void bfs(int x, int y) { check[x][y] = 1; q.push({ x,y }); while (!q.empty()) { int xx = q.front().first, yy = q.front().second; q.pop(); for (int i = 0; i < 4; i++) { int nx = xx + dx[i]; //..
[백준 2583번] 영역 구하기 (C++)
문제링크 : https://www.acmicpc.net/problem/2583 #include using namespace std; int area[100][100]; int n, m, k, cnt = 0, cnt2 = 0; int x1, x2, y11, y2; int dx[4] = { -1,1,0,0 }; int dy[4] = { 0,0,-1,1 }; queueq; vector v; void bfs(int x, int y) { area[x][y] = 1; q.push({ x,y }); while (!q.empty()) { int yy = q.front().first, xx = q.front().second; q.pop(); for (int i = 0; i < 4; i++) { int nx = xx + ..