Merged
Conversation
YoonYn9915
approved these changes
Jun 8, 2025
Member
YoonYn9915
left a comment
There was a problem hiding this comment.
이번 한주도 수고 많으셨습니다!!
이번 발제, 과제 문제는 쉽다고 생각했는데 오랫만에 풀어봐서인지 감을 못잡아서 생각보다 고생한 것 같아요. 좋은 문제 가져와 주셔서 복습에 도움 됐습니다
Comment on lines
+16
to
+21
Member
There was a problem hiding this comment.
제 PR에 작성해주신것 처럼 저는 while문 안에서 계속 1,000,000,007로 나머지 연산해주었어요. 파이썬은 2^0 부터 2^30 까지는 28바이트를 쓰고 그 이후부터는 2^30마다 4바이트씩 커지는데, 이 문제는 10억 이상 넘어가는 경우가 많이 나올수 있다고 생각해서 메모리를 아끼기 위해서 중간중간 계속 1,000,000,007로 나머지 연산 해주었습니다. 이 문제는 512MB제한이라 메모리가 넉넉해서 문제가 되지는 않았는데 더 적은 메모리에서는 이런 식으로 정답 저장에 쓰이는 메모리를 줄여줄 필요가 있을 것 같습니다.
Collaborator
Author
There was a problem hiding this comment.
좋은 정보 알려주셔서 감사해요!! 앞으로 이 부분 참고해서 작업해보도록 하겠습니다!
🔥2025-06 챌린지 진행 상황👉 그래프👉 구현 |
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.
🌱WIL
🚀주간 목표 문제 수: 3개
프로그래머스 #42627. 디스크 컨트롤러: 힙 / Level 3
정리한 링크: (바로가기)
🚩플로우 (선택)
jobs를 요청 시각 기준으로 정렬한다.end_time)을 갱신하고, 반환 시간을 누적한다.end_time = jobs[i][0]).🚩제출한 코드
💡TIL
시간 흐름에 따른 요청 → 처리 → 대기라는 순환 로직을 실제 운영체제의 스케줄링처럼 구현해야 했다.
처음엔 무작정 heap에 넣고 정렬해서 처리하면 될 거라 생각했지만,
시간 조건을 반영하지 않으면 전혀 다른 결과가 나올 수 있다는 걸 배웠다. 나중에 자바로도 풀이해봐야겠다.
또 오랜만에 힙 유형을 풀면서 heapq를 파이썬에서 적용하는 방법에 대해서도 알게 되었다.
https://docs.python.org/ko/3.13/library/heapq.html
https://velog.io/@plate0113/Python-%EC%9A%B0%EC%84%A0%EC%88%9C%EC%9C%84-%ED%81%90-heapq
https://lucky516.tistory.com/5
백준 #14698. 전생했더니 슬라임 연구자였던 건에 대하여 (Hard): 힙 / 골드4
정리한 링크: (바로가기)
🚩플로우 (선택)
T만큼 반복한다.N과 슬라임 에너지 리스트를 입력받는다.🚩제출한 코드
💡TIL
heapq모듈을 쓸 때 리스트를 힙으로 변환하지 않고heappop()을 사용했기 때문이다.heapq는 리스트가 힙 구조일 때만 최소값을 보장하므로heapify()를 반드시 해줘야 한다.heapq를 사용할 때는 반드시heapify()를 먼저 해주자!백준 #1715. 카드 정렬하기: 힙 / 골드4
정리한 링크: (바로가기)
🚩플로우 (선택)
🚩제출한 코드
💡TIL