백준 2589번 C++
#include #include #include using namespace std; const int MAX = 51;int n,m;char way[MAX][MAX];char shortestway[MAX][MAX]; typedef struct {int x, y;}Move;Move moves[4] = { {1,0},{-1,0},{0,1},{0,-1} }; int bfs(int i,int j) {int longestway=0;memset(shortestway, 0, sizeof(shortestway));queue q;q.push(make_pair(i, j)); while (!q.empty()) {int x = q.front().first;int y = q.front().second;q.pop(); for ..
2019. 1. 14.