열쇠
-
백준 9328번 열쇠PS 2021. 3. 29. 23:45
www.acmicpc.net/problem/9328 탐색이 1번으로 끝나지 않습니다. 탐색 도중 열쇠를 얻게 되면 탐색할 수 있는 공간이 늘어나기 때문이죠. 따라서 더 이상 열쇠를 얻지 않을때까지 탐색을 반복해주면 됩니다. #include #include #include #include #include using namespace std; #define MAX 1005 struct point { int y, x; }; int test; int n, m, res; char map[MAX][MAX]; bool visit[MAX][MAX]; string key; int dy[] = { 1, -1, 0, 0 }; int dx[] = { 0, 0, 1, -1 }; void print_map() { for (int..