(C++) - 백준(BOJ) 2583번 : 영역 구하기
#include #include #include #include using namespace std; queue q; vector dcnt(101); int la,ra,lb,rb, m, n, k, a[101][101],c[101][101], dx[] = { 0,0,-1,1 }, dy[] = { -1,1,0,0 },cnt; void BFS(int i,int j,int cnt) { q.push(make_pair(i,j)); dcnt[cnt]++; c[i][j] = 1; while (!q.empty()) { int x = q.front().first; int y = q.front().second; q.pop(); for (int i = 0; i < 4; i++)//4방향을 살펴본다 { int nx = x + ..
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 13700번:완전범죄 답
123456789101112131415161718192021222324252627282930313233343536373839404142434445#include #include using namespace std;int N, S, D, F, B, K, cnt[100001], nb, nf, police[100001], p, c[100001];queue q;void BFS(int x){ q.push(x); while (!q.empty()) { x = q.front(); q.pop(); int nb = x - B; int nf = x + F; if (0 N >> S >> D >> F >> B >> K; for (int i = 1; i > p; police[p] = 1; } cnt[D] = -1; BFS(S);..