백준 2206번 C++
#include #include #include using namespace std; const int MAX = 1000; int map[MAX][MAX]; int n, m; int visited[MAX][MAX][2]; struct Move { int x, y; }; Move mv[4] = { {1,0}, {-1,0} ,{0,1}, {0,-1} }; int bfs() { queue q; q.push(make_pair(0,make_pair(0,1))); visited[0][0][1] = 1; while (!q.empty()) { int currenti = q.front().first; int currentj = q.front().second.first; int broke = q.front().secon..
2019. 8. 15.
백준 3055번 C++
#include #include #include #include using namespace std; const int MAX = 51; string map[MAX]; int r, c; queue water,moves; pair room; int visited2[MAX][MAX]; struct Move { int x, y; }; Move mv[4] = { {1,0},{-1,0},{0,1},{0,-1} }; int bfs() { while (!moves.empty()) { int watersize = water.size(); for (int i = 0; i < watersize; i++) { int currenti = water.front().first; int currentj = water.front()..
2019. 8. 14.