public Map<Integer, Double> highFive(Record[] results) {
HashMap<Integer, PriorityQueue<Integer>> score = new HashMap<>();
for(Record s : results) {
if (!score.containsKey(s.id))
score.put(s.id, new PriorityQueue<Integer>());
PriorityQueue<Integer> pq = score.get(s.id);
pq.offer(s.score);
if (pq.size() > 5)
pq.poll();
}
Map<Integer, Double> res = new HashMap<>();
for(int sc : score.keySet()) {
PriorityQueue<Integer> pq = score.get(sc);
double sum = 0;
for (int i : pq)
sum += i;
res.put(sc, sum/5);
}
return res;
}