[20251030] BOJ / G4 / 최대최소 / 이종환 #1270
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/1999
🧭 풀이 시간
50분
👀 체감 난이도
✏️ 문제 설명
N×N의 행렬이 있다(1 ≤ N ≤ 250). 행렬의 각 성분은 250보다 작거나 같은 음이 아닌 정수이다. 당신에게는 K(1 ≤ K ≤ 100,000)개의 질문이 주어진다. 각 질문은, 주어진 행렬의 B×B 크기의 부분행렬의 최댓값과 최솟값의 차이를 묻는 질문들이다(1 ≤ B ≤ N). 각 질문에 대해서, 부분행렬의 가장 왼쪽 위의 위치가 주어지며, 모든 질문들은 같은 B값을 갖는다. 질문에 답하는 프로그램을 작성하시오.
🔍 풀이 방법
minQ와 maxQ라는 두 개의 PQ, 그리고 Map을 이용해서 계속해서 특정 구간의 모든 숫자 정보를 보관하면서 진행하였다.
⏳ 회고