[파이썬] 코드트리 : 고대 문명 유적 탐사 (골드4)
[파이썬] 코드트리 : 고대 문명 유적 탐사 (골드4)https://www.codetree.ai/training-field/frequent-problems/problems/ancient-ruin-exploration/description?page=1&pageSize=20풀이방향성 생각BFS + 구현회전은 피벗 주변 8칸을 큐에 담아서 rotate 전체코드from collections import dequeK,M = map(int,input().split())arr = [list(map(int,input().split())) for _ in range(5)]numbers = list(map(int,input().split()))dire = [(1,0),(0,1),(-1,0),(0,-1)]# BFS를 돌려서..
2024. 5. 1.
[파이썬] 코드트리 : 예술성 (골드3)
[파이썬] 코드트리 : 예술성 (골드3) https://www.codetree.ai/training-field/frequent-problems/problems/artistry/description?page=1&pageSize=20 풀이 방향성 생각 BFS로 덩어리 찾기. 배열 순회하면서 경계선 카운팅 해주기. list(zip(*array)) + a로 시계, 반시계 구현하기. 전체코드 from collections import deque, defaultdict as dd N = int(input()) arr = [list(map(int,input().split())) for _ in range(N)] dire = [(1,0),(0,1),(-1,0),(0,-1)] # 각 사이클 마다 BFS 진행. 덩어리의 ..
2024. 4. 7.