[20251008] BOJ / G4 / 백룸 / 한종욱 #1066
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/26259
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
2차원 좌표를 지나갈 때마다, 값을 더하는데 벽은 통과하지 못한다. 최대값은?
🔍 풀이 방법
DP다. 간단한 DP인데, 벽을 나타내는 좌표의 순서가 오름차순으로 보장되어 있지 않다.
그것만 조심하면 된다.
⏳ 회고
처음엔 BFS로 접근했다. 방향이 두 개이기 때문에, 방문처리를 안해도 된다고 생각했다. 그렇지만, 방향이 두 개여도 같은 좌표들이 중복으로 들어가면$2^{n}$ 으로 개수가 늘어난다. 그래프로 시도했으면 차라리 다익스트라로 했어야 한다고 생각한다. 이제, 최대값을 찾는 다익스트라로.
-> 그치만 다익스트라도 안되네. 가중치에 음수가 있어서 안되고 벨만-포드도 시간복잡도 때매 안될꺼 같다. 그냥 DP가 최선인듯
다음엔 벽을 나타내는 좌표의 순서가 오름차순으로 보장되어 있는 줄 알고 벽을 기준으로 이동하는 valid 함수를 잘못 작성했다.