New update is available. Click here to update.

Last Updated: 27 Feb, 2021

Difficulty: Moderate

```
1. It is guaranteed that for each player, there are at least 5 entries of his scores in the list ‘Records’.
2. You need to find the floor value of the top 5 scores average.
3. Different players have different IDs.
```

```
Consider a List ‘Records’ = [[1, 10], [1, 11], [2, 13], [2, 15], [1, 9], [2, 1], [1, 21], [2, 21], [2, 1], [1, 19], [1, 9], [2, 11], [1, 7]],
Clearly, there are two players, with ID 1 and 2, respectively.
The top 5 scores of the player with ID 1 are 21, 19, 11, 10, 9, and the average of these scores is 14.
The top 5 scores of the player with ID 2 are 21, 15, 13, 11, 1, and the average of these scores is 12.
Thus, we should return a list ‘topFiveAverages’ = [[1, 14], [2, 12]]
```

```
The first line of input contains an integer ‘T’ denoting the number of test cases, then ‘T’ test cases follow.
The first line of each test case consists of a single integer ‘N’, representing the size of the list ‘Records’.
Then next ‘N’ lines follow in each test case, and each of these ‘N’ lines consists of two space-separated integers, represent the ID and Score of the player.
```

```
For each test case, in a separate line, print 2*K space-separated integers, where ‘K’ is the number of unique players in ‘Records’. The Id and top 5 average of the player having the ith smallest ID are given by (2*i + 1)th and (2*i + 2)th integer respectively.
```

```
You do not need to print anything, it has already been taken care of. Just implement the given function.
```

```
1 <= T <= 50
1 <= N <= 10^4
1 <= ID <= 10^9
0 <= Score <= 10^5
Time limit: 1 sec
```

SIMILAR PROBLEMS

Max Prefix

Posted: 31 Oct, 2022

Difficulty: Easy

Longest Subarray With Zero Sum

Posted: 3 Nov, 2022

Difficulty: Moderate

Merge Two Sorted Arrays Without Extra Space

Posted: 19 Nov, 2022

Difficulty: Moderate

Maximum GCD

Posted: 8 Dec, 2022

Difficulty: Hard

Sort 0s, 1s, 2s

Posted: 24 Dec, 2022

Difficulty: Easy

Popular Interview Problems: