[Programmers] 2022 KAKAO BLIND RECRUITMENT - 사라지는 발판
코드def solution(board, aloc, bloc): M, N = len(board), len(board[0]) directions = [(1, 0), (-1, 0), (0, 1), (0, -1)] def dfs(cur_r, cur_c, opp_r, opp_c): # 현재 플레이어가 서 있는 발판이 이미 사라졌다면 패배 if board[cur_r][cur_c] == 0: return False, 0 can_move = False is_win = False min_dist = float('inf') max_dist = 0 board[..
2026. 4. 22.
[삼성 SW 역량테스트] 메이즈 러너
Python 코드import sysinput = sys.stdin.readlinedef solve(): N, M, K = map(int, input().split()) board = [list(map(int, input().split())) for _ in range(N)] person_pos = {} # {참가자 id: (현재 행, 열)} for i in range(M): id = i + 1 r, c = map(int, input().split()) r, c = r-1, c-1 # 0-based person_pos[id] = (r, c) # 보드에 출구 좌표 표시 er, ec = map(int, input().split(..
2026. 4. 12.
[삼성 SW 역량테스트] 마법의 숲 탐색
코드import sysfrom collections import dequeinput = sys.stdin.readlinedef solve(): R, C, K = map(int, input().split()) # 숲의 상태 (0: 빈칸, 1~K: 골렘 번호) (0, 1, 2행은 숲 밖) board = [[0] * (C + 1) for _ in range(R + 4)] is_exit = [[False] * (C + 1) for _ in range(R + 4)] # 북, 동, 남, 서 dr = [-1, 0, 1, 0] dc = [0, 1, 0, -1] total_score = 0 for k in range(1, K + 1): ci, di = ..
2026. 4. 9.