Calculating grades
InterviewTime limit1sMemory limit1024 MB
Given N scores from 0 to 100, count how many students receive each Suneung grade from 1 to 9 using the cumulative-share cutoffs.
- Level
Easy3 of 10
- Topics
- Implementation, Prefix sum, Array
- Solved
- No attempts yet
Problem
Middle school grades are based on absolute evaluation, but you, a student at Dongnae High School, receive relative grades from 1 to 9 for both school grades and the college entrance exam (Suneung).
Chansol had nothing to do with the college entrance exam until he graduated from high school, so even now he does not know the detailed rules for calculating Suneung grades. Given the number of people who took one subject and the score each person received, write a program that counts how many students receive each grade from 1 to 9.
The Suneung grade cutoffs are as follows.
Specifically, the grade cutoff score for grade 1 is the largest such that at least 4% of students scored between points and 100 points. Every student who scored or higher receives grade 1. Similarly, the grade cutoff score for grade 2 is the largest such that at least 11% of students scored between points and 100 points. Every student who scored below the grade 1 cutoff and at or above the grade 2 cutoff receives grade 2. If at least 11% of students scored at or above the grade 1 cutoff, then all of those students receive grade 1, and the grade 2 cutoff equals the grade 1 cutoff, so no student receives grade 2.
A grade blank means that no student receives that grade.
Input
The first line contains the number of people who took the subject.
The second line contains the scores that each person received, separated by spaces.
Output
Print the number of students who receive grade 1, grade 2, , grade 9, one per line.
If no student receives a given grade, print for that grade.
Constraints
- All numbers in the input are integers.
Hint
The conditions for each grade are as follows.
A student who scores points, which meets the condition for grade , receives grade .
For example, suppose , 11 people scored 100, 1 person scored 99, and everyone else scored below 99. Since 0% of students scored above 100, the 11 students who scored 100 all receive grade 1. Since 11% of students scored above 99, the student who scored 99 receives grade 3, not grade 2. As in this example, a grade blank means that no student receives grade 2.