https://school.programmers.co.kr/learn/courses/30/lessons/12941
import java.util.*;
class Solution
{
public int solution(int []A, int []B)
{
int answer = 0;
Queue<Integer> pq = new PriorityQueue<>();
Queue<Integer> rpq = new PriorityQueue<>(Collections.reverseOrder());
for(int i : A)
{
pq.add(i);
}
for(int i : B)
{
rpq.add(i);
}
while(pq.isEmpty() == false)
{
answer += pq.poll() * rpq.poll();
}
return answer;
}
}