[DFS/BFS 알고리즘] 미로 탈출 - 파이썬(python)
미로 탈출 난이도 : 中下 풀이 시간 : 30분 시간 제한 : 1초 메모리 제한 : 128 MB 해답 from collections import deque n, m = map(int, input().split()) maze = [] for i in range(n): maze.append(list(map(int, input()))) dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] def bfs(x, y): queue = deque() queue.append((x, y)) while queue: x, y = queue.popleft() for i in range(4): nx, ny = x + dx[i], y + dy[i] if nx = n or ny ..
[구현 알고리즘] 게임 개발 - 파이썬(python)
게임 개발 난이도 : 中 풀이 시간 : 40분 시간 제한 : 1초 메모리 제한 : 128 MB 해답 n, m = map(int, input().split()) x, y, direction = map(int, input().split()) array = [] for i in range(n): array.append(list(map(int, input().split()))) darray = [[0] * m for _ in range(n)] dx = [-1, 0, 1, 0] dy = [0, 1, 0, -1] darray[x][y] = 1 count = 1 turned_count = 0 while True: direction = direction - 1 if direction == -1: direction = ..