From eff27fb7d5bf6b1d12dc5d47ef97b0334c2b8374 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Sun, 7 Sep 2025 19:52:54 +0900 Subject: [PATCH] =?UTF-8?q?[20250907]=20PGM=20/=20LV3=20/=20=EC=95=BC?= =?UTF-8?q?=EA=B7=BC=20=EC=A7=80=EC=88=98=20/=20=EC=9D=B4=EA=B0=95?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\352\267\274 \354\247\200\354\210\230.md" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "lkhyun/202509/07 PGM LV3 \354\225\274\352\267\274 \354\247\200\354\210\230.md" diff --git "a/lkhyun/202509/07 PGM LV3 \354\225\274\352\267\274 \354\247\200\354\210\230.md" "b/lkhyun/202509/07 PGM LV3 \354\225\274\352\267\274 \354\247\200\354\210\230.md" new file mode 100644 index 00000000..5695de76 --- /dev/null +++ "b/lkhyun/202509/07 PGM LV3 \354\225\274\352\267\274 \354\247\200\354\210\230.md" @@ -0,0 +1,26 @@ +```java +import java.util.*; +class Solution { + static PriorityQueue pq = new PriorityQueue<>((a,b) -> Integer.compare(b,a)); + public long solution(int n, int[] works) { + long answer = 0; + for(int i : works){ + pq.offer(i); + } + for(int i=0;i 1){ + pq.offer(--cur); + } + }else{ + return 0; + } + } + for(int i : pq){ + answer += i*i; + } + return answer; + } +} +```