-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
생각에 대한 정리가 리뷰를 하면서 되는 것 같아서 갑자기 힘이 빠지네요... 좋은 코드로 가독성 너무 좋게 작성해주셔서 많은 도움이 되었습니다. 감사합니다. 수민님!
# 행, 열의 개수 | ||
n, m = map(int, input().split()) | ||
graph = [list(map(int, input().split())) for _ in range(n)] # 그래프(빙산과 바다 정보) | ||
ice = set() # 빙산 좌표 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와 생각해보니 꼭 덱을 안써도 괜찮네요 순서를 보장하지 않아도 좋으니 set을 써서 시간을 조금 더 올리는 것이 좋아보입니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ice는 말씀해주신 것처럼 현재 남아있는 빙산의 좌표를 유지하는 역할이라 순서는 중요하지 않아요!
BFS함수에서 빙산이 녹아버리면(0이 되면) ice에서 해당 빙산의 좌표를 remove 해줘 최신 상태의 빙산 좌표를 유지할 수 있어요~!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
왜 ice라는 set을 활용했는지 풀이를 보면서 의문이었는데, 값이 0인 위치가 빙산이었는지, 애초에 바다였는지 구분하기 위함이군요! 좋은 풀이라고 생각합니다. set을 활용한 이유를 조금 더 명시적으로 작성해주시면 코드를 처음 보는 입장에서 더 좋을 것 같다고 생각합니다. 수민님 고생하셨습니다!
주석이 부족했던 것 같아요!! ㅜㅜ |
PR Summary
풀이시간: 40분
<input>
<solution>
<시간복잡도>
O(10 * k * n*m)