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; + } +} +```