자율 주행 자동차
방향 때문에 머리가 아팠지만 특별한 부분은 없이 시키는데로 구현만 잘하면 됐던 문제였습니다. :) import sys answer = 0 n, m = map(int, sys.stdin.readline().strip().split()) y, x, d = map(int, sys.stdin.readline().strip().split()) dy, dx = [-1, 0, 1, 0], [0, 1, 0, -1] graph = [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)] visited = [[False for _ in range(m)] for _ in range(n)] check_count = 0 visited[y][x] = Tru..
방화벽 설치하기
아주 예전에 친구들과 1일 1문제 했을 때 풀었던 문제. 위치값 저장해서 방화벽 놓을 수 있는 모든 경우의 수에 불이 퍼지게 해서 최소값만 리턴하면 끝남. import sys import copy from itertools import combinations from collections import deque maxCount = 0 copyGraph = [] def bfs(x, y, n , m): global copyGraph dx, dy = [-1, 1, 0, 0], [0, 0, -1, 1] queue = deque() queue.append((x, y)) while queue: x, y = queue.popleft() for z in range(4): nx = x + dx[z] ny = y + dy..