[20260114] BOJ / P5 / 소방서의 고민 / 한종욱 #1793
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/2180
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
화재의 종류에 따라서, 화재 발생 후 소방차가 t초 후에 도착하면 화재를 진압하는데 걸리는 시간은 at +b와 같이 1차 함수의 형태로 나타나게 된다. 모든 화재 사건은 시각 0에서 발생하였다. 당신은 모든 화재를 진압하는데 걸리는 최소 시간이 얼마인지를 알고 싶다.
🔍 풀이 방법
1번 작업 후 2번 작업을 한다고 했을 때,
2번 작업 후 1번 작업을 한다고 했을 때,
하지만, a, b가 0이면 저 부등호에 문제가 생긴다. 따라서,$a_1, a_2$ 가 0인 경우를 각각 예외처리 해줘야 한다.
⏳ 회고
compare 함수
o1이 더 작다 (우선순위 높음)o1을o2보다 앞에 세운다. (그대로 둠)o1이 더 크다 (우선순위 낮음)o1을o2뒤로 보낸다. (자리를 바꿈)