From 4cd14bcbe11220b470c01b056b8bdc7b2b603fd0 Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Fri, 14 Nov 2025 23:01:32 +0900 Subject: [PATCH] =?UTF-8?q?[20251114]=20PGM=20/=20LV2=20/=20=EC=B5=9C?= =?UTF-8?q?=EC=86=9F=EA=B0=92=20=EB=A7=8C=EB=93=A4=EA=B8=B0=20/=20?= =?UTF-8?q?=EC=9D=B4=EC=A2=85=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\222 \353\247\214\353\223\244\352\270\260" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "0224LJH/202511/14 PGM \354\265\234\354\206\237\352\260\222 \353\247\214\353\223\244\352\270\260" diff --git "a/0224LJH/202511/14 PGM \354\265\234\354\206\237\352\260\222 \353\247\214\353\223\244\352\270\260" "b/0224LJH/202511/14 PGM \354\265\234\354\206\237\352\260\222 \353\247\214\353\223\244\352\270\260" new file mode 100644 index 00000000..7ba07d8f --- /dev/null +++ "b/0224LJH/202511/14 PGM \354\265\234\354\206\237\352\260\222 \353\247\214\353\223\244\352\270\260" @@ -0,0 +1,27 @@ +```java +import java.io.*; +import java.util.*; + +class Solution +{ + public int solution(int []A, int []B) + { + + PriorityQueue pq = new PriorityQueue<>(); + PriorityQueue rPq = new PriorityQueue<>(Collections.reverseOrder()); + for (int n: A){ + pq.add(n); + } + for (int n: B){ + rPq.add(n); + } + + int ans = 0; + for (int i = 0; i < A.length; i++){ + ans += pq.poll() * rPq.poll(); + } + + return ans; + } +} +```