[20250821] PGM / LV3 / 광고 삽입 / 혁준 #708
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://school.programmers.co.kr/learn/courses/30/lessons/72414?language=java
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
동영상의 길이와 광고의 길이가 주어지고, 사람들의 영상 시청 시작 시각과 종료 시각이 주어진다.
동영상 중간에 광고를 넣어서 사람들의 누적 광고 시청 시간을 최대로 해보자.
🔍 풀이 방법
0초 ~ 360,000초까지 범위가 제한되기 때문에, 시각을 정수로 바꿔서 풀었다.
사람들의 영상 시청 구간으로 imos를 해서 각 순간마다의 시청자 수를 구하고,
이걸로 누적 합 구한뒤 슬라이딩 윈도우로 누적 광고 시청 시간의 최대 지점을 찾았다.
⏳ 회고
헷갈린다