[20250919] PGM / LV2 / 완전범죄 / 김수연 #928
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/389480
🧭 풀이 시간
50분
👀 체감 난이도
✏️ 문제 설명
두 도둑이 팀을 이루어 모든 물건을 훔치려고 할 때, 경찰에 잡히지 않도록 흔적을 최소화 해야함
A도둑이 훔치면 info[i][0]개의 A에 대한 흔적을 남김
B도둑이 훔치면 info[i][1]개의 B에 대한 흔적을 남김
각각 n, m 흔적보다 적게 남겨야하며
A도둑이 남긴 흔적의 누적 개수의 최솟값 구하기
🔍 풀이 방법
dp사용
dp배열에 a 도둑이 훔쳤을 때, b 도둑이 훔쳤을 때를 전부 돌면서 갱신해줌
이후에 a도둑의 최솟값 return하면됨
⏳ 회고
난 dp가 너무 어렵다