BFS 4

백준 2178번 c++ 풀이

알고리즘 분류: 그래프 이론, bfs 코드: #include #include #include #include using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); string arr[101]; // 미로 int dist[101][101]; // 이동 거리 bool chk[101][101]; // 방문 체크 queue Q; int n,m; cin >> n >> m; int dx[4] = {1,0,-1,0}; int dy[4] = {0,1,0,-1}; for(int i=0; i> arr[i]; } dist[0][0] = 1; Q.push({0,0}); chk[0][0] = 1; while(!Q.empty()){ pair cur = Q.f..

BOJ 문제풀이 2021.07.20