The Seven Warlords
Time limit10sMemory limit256 MB
Given up to ten million student grades, output the seven lowest grades in increasing order, one per line. Ties on the cut line still yield exactly seven grades.
- Level
Medium4 of 10
- Topics
- Sorting, Heap, Array, Implementation
- Solved
- No attempts yet
Problem
Joe is a professor who teaches a logic circuit design course. At the start of the term he promised a good grade to every student except seven.
Given the final grade of every student, find the grades of the seven students with the lowest grades. Joe takes those seven to his lab, You See Lab, and calls them the Seven Warlords.
Input
The first line contains the number of students .
Each of the next lines contains the grade of one student, in arbitrary order. A grade is at least 0 points and at most 100 points, is awarded in steps of 0.001 points, and is written with exactly three digits after the decimal point.
Output
Print the grades of the seven students with the lowest grades, one per line, in increasing order. Print each grade with three digits after the decimal point, the same way the input gives it. If students tie on the cut line, still print exactly seven grades.