diff --git "a/suyeun84/202510/08 PGM LV2 \354\204\234\353\262\204 \354\246\235\354\204\244 \355\232\237\354\210\230.md" "b/suyeun84/202510/08 PGM LV2 \354\204\234\353\262\204 \354\246\235\354\204\244 \355\232\237\354\210\230.md" new file mode 100644 index 00000000..d78436a1 --- /dev/null +++ "b/suyeun84/202510/08 PGM LV2 \354\204\234\353\262\204 \354\246\235\354\204\244 \355\232\237\354\210\230.md" @@ -0,0 +1,24 @@ +```java +import java.util.*; +class Solution { + public int solution(int[] players, int m, int k) { + PriorityQueue pq = new PriorityQueue<>((o1,o2) -> o1[0] - o2[0]); + int size = 0; + int count = 0; + for(int i = 0; i < 24; i++){ + while(!pq.isEmpty() && pq.peek()[0] == i){ + size -= pq.poll()[1]; + } + int need = players[i] / m; + int more = size - need; + if(more < 0){ + more = -more; + size += more; + count += more; + pq.add(new int []{i + k, more}); + } + } + return count; + } +} +```