Merged
Conversation
zaqquum
approved these changes
Jun 22, 2025
Collaborator
There was a problem hiding this comment.
저는 이번 문제는 다른 풀이 참고해서 아래와 같이 for 문 탐색순서를 우선순위 따라 나열했는데 ** 0-1BFS** 란 풀이 유형이라는 건 처음 알았네요.
풀이 유형을 정의하고, 그에 대해 가독성 좋게 정리해주셔서 덕분에 이해가 잘 됐습니다!
for nx in (2*cx , cx-1 , cx+1 ) :
YoonYn9915
approved these changes
Jun 22, 2025
Member
YoonYn9915
left a comment
There was a problem hiding this comment.
숨바꼭질 3 문제 20분만에 푸셨다니 저보다 훨씬 빨리 정확하게 푸셨네요👍 👍
전 주 풀었던 숨바꼭질 1-2 문제가 많은 도움이 되었던 것 같습니다.
이번 한주도 고생많으셨어요~
Comment on lines
+16
to
+20
Member
There was a problem hiding this comment.
넵 이번 숨바꼭질 3문제는 숨바꼭질 2문제의 기본 뼈대에
0초에 일어나는 '순간이동' 동작은 다른 두 동작보다 우선순위가 높아(두 동작보다 빨리 끝나니까) 항상 순간이동한 좌표를 큐의 앞에 위치시키는 것이 핵심인 문제였습니다.
저는 순간이동을 처리할 때 그냥 for문안에 if문을 활용했는데 민정님처럼 appendleft()를 쓰거나 우선순위큐를 쓰면 더욱 가독성있는 코드가 될 것같습니다.
🔥2025-06 챌린지 진행 상황👉 그래프
👉 구현
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🌱WIL
과제문제에서는 0-1 BFS 유형을 알게 되었다.0-1 BFS를 구현하기 위해서는 우선순위가 높은 것은 (deque 기준으로) appendleft로 우선 탐색할 수 있도록 해주어야 한다는 것을 알게 되었다.키패드 누르기문제는 Level1이었지만 처음에 문제의 아이디어를 내기까지는 부끄럽지만 조금 시간이 걸렸다. 하지만 정말 단순하게 풀면 되는 문제였다.🚀주간 목표 문제 수: 3개
백준 #14226. 이모티콘: 그래프 / 골드4
정리한 링크: (바로가기)
(화면, 클립보드)상태를 저장한다.(screen, screen)(screen + clipboard, clipboard)— 단, clipboard가 0이 아니어야 함(screen - 1, clipboard)visited체크를 통해 중복 방문을 방지한다.S에 도달하면 해당 시간을 출력하고 종료한다.🚩플로우 (선택)
🚩제출한 코드
💡TIL
MAX값을 1001로 지정해야 했는데 1000으로 지정한 점 등 잘못 지정한 게 많았기에 시간 내에 풀지 못해 아쉽다.프로그래머스 #67256. 키패드 누르기: 그리디 / Level 1
정리한 링크: (바로가기)
🚩플로우 (선택)
*, 오른손은#이다.LR🚩제출한 코드
💡TIL
백준 #13549. 숨바꼭질3: 그래프 / 골드5
정리한 링크: (바로가기)
🚩플로우 (선택)
100000까지 탐색할 수 있도록 범위 상수를 선언한다.visited리스트를1로 초기화하여 방문 여부와 시간을 동시에 기록한다.deque를 생성하고 시작 위치를 넣는다.2 * x(순간이동):appendleft(), 시간 변화 없음x ± 1(걷기):append(), 시간 +1K에 도달하면 종료한다.🚩제출한 코드
💡TIL