
Baekjoon/DFS와 BFS
🥇[백준] 10026 적록색약 (골드5) / BFS
문제요약 나의 코드 및 설명 RGB를 012로 변환. 지금 생각해보니 for _ in ("R","G,","B")로 하면 되지 않았을까 싶다. 0,1,2 돌면서 적록색약 아닌 사람 먼저 카운트 그리드 중 R,G(0,1)을 같게 만든다. G,B(1,2) 돌면서 적록색약인 사람 카운트 from collections import deque def bfs(sx,sy,color,v): queue = deque() queue.append((sx,sy)) v[sy][sx] = 1 while queue: x,y = queue.popleft() for i in range(4): nx = x + dx[i] ny = y + dy[i] if nx=n: continue else: if board[ny][nx] == color a..