This page is still under construction.

Parts of this page are still being built. What you see may change.

Grade Statistics

Interview

Time limit1sMemory limit128 MB

Summary
For each class, read the scores, then report the maximum, the minimum, and the largest gap between neighboring scores after sorting in descending order.
Level

Easy2 of 10

Topics
Sorting, Implementation, Array
Solved
No attempts yet

Problem

Han Sang-deok is the newly appointed principal of Jungdeok High School. His first job as principal is to compile statistics on each class's math exam scores.

Given the math exam scores of the students in each class, write a program that finds, for every class, the maximum score, the minimum score, and the largest difference between two adjacent scores when the scores are sorted in descending order.

Input

The first line contains the number of classes KK (1≤K≤1001 \le K \le 100).

Each of the next KK lines describes one class. The first integer on the line is the number of students NN (2≤N≤502 \le N \le 50) in that class, followed by the NN math scores separated by spaces. Each score is an integer between 00 and 100100, inclusive.

Output

For each class, print two lines.

  • The first line is Class X, where XX is the class number. It starts at 11 and increases by 11 in the order the classes are given in the input.
  • The second line is printed in the format Max A, Min B, Largest gap C, where AA is the highest score in the class, BB is the lowest score, and CC is the maximum difference between two adjacent scores when the scores are sorted in descending order.

Examples4

  1. Example 1

    Input
    2
    5 30 25 76 23 78
    6 25 50 70 99 70 90
    
    Expected output
    Class 1
    Max 78, Min 23, Largest gap 46
    Class 2
    Max 99, Min 25, Largest gap 25
    
  2. Example 2

    Input
    1
    2 0 100
    
    Expected output
    Class 1
    Max 100, Min 0, Largest gap 100
    
  3. Example 3

    Input
    1
    3 50 50 50
    
    Expected output
    Class 1
    Max 50, Min 50, Largest gap 0
    
  4. Example 4

    Input
    3
    2 10 20
    3 1 2 3
    4 100 0 50 25
    
    Expected output
    Class 1
    Max 20, Min 10, Largest gap 10
    Class 2
    Max 3, Min 1, Largest gap 1
    Class 3
    Max 100, Min 0, Largest gap 50