[20250917] BOJ / D5 / Historical Research / 권혁준#912
Merged
ShinHeeEul merged 1 commit intomainfrom Sep 17, 2025
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/17731
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
N일간의 일기에서 각 날의 사건 종류가 X[i]로 주어짐
Q개의 쿼리(기간)에 대해 각각 처리
각 기간에서 사건 종류 t의 중요도 = t × (해당 기간에서 종류 t의 출현 횟수)
모든 사건 종류의 중요도 중 최댓값을 구하는 것이 목표
🔍 풀이 방법
일단 사건 종류 값을 압축해놓고 시작했다.
-> 사건 종류를 인덱스로 갖는 세그트리를 만들 수 있다.
쿼리를 mo's로 정렬하고, 현재 고려중인 사건들을 모두 세그먼트 트리에 담아서 중요도 최댓값을 구해줬다.
⏳ 회고
괜히 시간 좀 줄여보겠다고 이상한 거 썼다가 알 수 없는 런타임에러가 뜸.
지우고 원래대로 하니까 맞음