[20260317] BOJ / P1 / 지형 평탄화 탐색기 / 권혁준#2027
Merged
ShinHeeEul merged 1 commit intomainfrom Mar 16, 2026
Merged
Conversation
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.
🧷 문제 링크
https://www.acmicpc.net/problem/33908
🧭 풀이 시간
👀 체감 난이도
✏️ 문제 설명
N*M 격자 모양의 지형이 있고, 각 칸의 높이는 1 이상 5 이하이다.
두 종류의 쿼리를 처리해보자.
🔍 풀이 방법
높이 정보를 0 이상 4 이하로 변경한다면, 모든 가능한 작업계획도를 5진법으로 해싱할 수 있다.
type[r][c] = r행 c열의 작업계획도에 대한 Count 클래스라고 정의했다.Count 클래스에는 각 해시값에 대한 경우의 수를 int 배열에 저장한다.
해시값의 범위는 [0, 5^9)이며, 이는 1953125 미만이기 때문에 TreeMap 대신 배열을 선택했다.
모든 매핑에 대한 경우의 수를 미리 다 구해놓고, 변경될 때마다 변경된 곳에 대한 해시만 다시 계산해서 넣어주는 방식으로 구현했다.
⏳ 회고
드디어