[20251114] BOJ / P4 / 구슬 발사기 / 권혁준 #1410
Merged
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.
🧷 문제 링크
https://www.acmicpc.net/problem/23329
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
2차원 좌표 평면에 N개의 구슬 발사기가 있다.
구슬 발사기는 8방향을 바라볼 수 있고, i번째 구슬 발사기를 시계 방향으로 45도 회전시키는 비용은 c[i]이다.
구슬 발사기들을 적절히 회전시켜서, 발사기 s로에서 출발하여 e에 도착하는 비용을 최소로 하고 그 경로를 출력해보자.
🔍 풀이 방법
8방향 각각에 대한 직선을
map으로 관리한다.같은 직선에 포함된 점들을 모두 정렬시켜서 그래프를 구성해주고
다익스트라를 돌려 해결했다.경로 출력은 다익스트라 트리에 대한
역추적으로 구해줬다.⏳ 회고
어질어질