백준 16234번 C++
#include #include #include #include using namespace std; const int MAX = 51; int n, l, r; int map[MAX][MAX]; bool possible = false; int visited[MAX][MAX]; struct Move { int x, y; }; Move mv[4] = { {1,0}, {0,1}, {-1,0}, {0,-1} }; void bfs(int i, int j) { int sum = 0; queue q; vector temp; q.push(make_pair(i, j)); temp.push_back(make_pair(i, j)); sum += map[i][j]; visited[i][j] = 1; while (!q.empt..
2019. 10. 9.
백준 5427번 C++
#include #include #include #include using namespace std; int const MAX = 1000; int w, h; string map[MAX]; vector firecopy; pair location; int visited[MAX][MAX]; struct Move { int x, y; }; Move mv[4] = { {-1,0},{1,0},{0,1},{0,-1} }; bool exitcheck(int i, int j) { if (i == 0 || i == h - 1 || j == 0 || j == w - 1) return true; else return false; } int bfs() { int day = 0; queue loc; loc.push(locati..
2019. 8. 21.