[20251027] BOJ / P3 / Pyramid / 권혁준 #1245
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/5479
🧭 풀이 시간
70분
👀 체감 난이도
✏️ 문제 설명
NM 격자에서 (AB 크기의 직사각형 내에 적힌 수의 합) - (그 안에 C*D 크기의 직사각형 내에 적힌 수의 합) 이 최대가 되도록 하는 직사각형 배치를 구해보자.
🔍 풀이 방법
AB 크기의 누적 합과 CD 크기의 누적 합을 미리 계산해놓는다.
CD 크기의 누적 합 원소들로
Monotone Deque을 두 번 써서 2차원 직사각형 최솟값을 구해놓고, AB 누적 합과의 차이 중 최댓값을 구해줬다.⏳ 회고
왜 틀리지 진짜 모르겠어서 열받는다