-
Notifications
You must be signed in to change notification settings - Fork 0
[20250910] BOJ / G2 / 중앙값 구하기 / 김민진 #863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
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.
🧷 문제 링크
중앙값 구하기
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
최소힙, 최대힙 두 개 사용해야함
🔍 풀이 방법
홀수는 최대힙, 짝수는 최소힙에 넣음
최대힙에는 작은 수 + 중앙값, 최소힙은 큰 수
만약 홀수일 때
maxq.peek()이minq.peek()보다 크면 바꿔줍니다(최대힙에 작은 수가 들어가야하니까)이러고 홀수 확인할 때
maxq.peek()출력해주면 됨.10개 단위로 줄바꿈 해야함
출력되는 중앙값 개수는
숫자 / 2 + 1⏳ 회고
충돌나서 리베이스햇더니 커밋꼬라지 난리낫네요 심란하다
내일 바꿔놓을게요...