P7426 [THUPC 2017] Physical Education Score Statistics.
Background
As the saying goes, “Without physical education, there is no Tsinghua.” In order to better encourage students to exercise and to evaluate them in a more scientific way, the teachers of Wudaokou Sports School have put a lot of effort into the assessment of physical education scores. However, at the end of each semester, when facing a huge amount of raw data, how to process the data and obtain each student’s overall physical education score becomes a major problem for the teachers in the PE department.
Description
For freshmen, the overall score of the physical education course consists of five parts: the course-specific score (full mark $50$), the long-distance run test score (full mark $20$), the “Sunshine Long Run” score (full mark $10$), the physical fitness test score (full mark $10$), and the “Freshman Special Program” score (full mark $10$).
The course-specific score is given directly by the PE teacher.
The long-distance run test score is determined by the final long run test. Boys need to run $3000$ meters, and girls need to run $1500$ meters. The scoring standard is:
| | $20$ | $18$ | $16$ | $14$ | $12$ | $10$ | $8$ | $6$ | $4$ | $2$ |
| :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: |
| Boys | $12'30''$ | $13'00''$ | $13'30''$ | $14'00''$ | $14'30''$ | $15'10''$ | $15'50''$ | $16'30''$ | $17'10''$ | $18'00''$ |
| Girls | $6'40''$ | $6'57''$ | $7'14''$ | $7'31''$ | $7'50''$ | $8'05''$ | $8'20''$ | $8'35''$ | $8'50''$ | $9'00''$ |
“Sunshine Long Run” uses a mobile App to record students’ extracurricular long running. By filtering the raw running data, we obtain the number of valid extracurricular runs, and then determine the score for this part.
A valid exercise record must satisfy all of the following:
- For boys, the running distance is at least $3000$ meters (including $3000$ meters). For girls, the running distance is at least $1500$ meters (including $1500$ meters).
- The average speed (distance / (end time - start time)) is not slower than $2$ meters per second and not faster than $5$ meters per second.
- The total pause time must not exceed $4$ minutes $30$ seconds.
- The average stride length (distance / number of steps) must not exceed $1.5$ meters.
- The start time must be at least $6$ hours (including $6$ hours) later than the end time of the previous valid record.
The correspondence between the number of valid “Sunshine Long Run” records and the score for this part is:
| Score | $10$ | $9$ | $8$ | $7$ | $6$ | $4$ | $2$ |
| :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: |
| Count | $[21,+\infty)$ | $[19,20]$ | $[17,18]$ | $[14,16]$ | $[11,13]$ | $[7,10]$ | $[3,6]$ |
For the physical fitness test part, if the student meets the passing standard, they get the full $10$ points for this part; otherwise, they get $0$ points for this part.
The $10$ points of the “Freshman Special Program” consist of two parts: attendance counts for $5$ points, and the final assessment for $5$ points.
The attendance count is the sum of the number of times participating in the “Class Training Camp” and the number of valid “Sunshine Long Run” records. The correspondence between the attendance score and the attendance count is:
| Score | $5$ | $4$ | $3$ | $2$ | $1$ |
| :----------: | :----------: | :----------: | :----------: | :----------: | :----------: |
| Count | $[18,+\infty)$ | $[15,17]$ | $[12,14]$ | $[9,11]$ | $[6,8]$ |
It is not hard to see that accurately calculating everyone’s PE score is not an easy task. Therefore, the PE department teacher came to you, who are participating in the on-campus contest. He will provide all the data needed and hopes you can help compute each Tsinghua freshman’s overall PE score (on a percentage scale) and grade.
The correspondence between percentage scores and grades (and GPA) is:
| A | A- | B+ | B | B- | C+ | C | C- |D+ | D | F |
| :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: |
| $[95,100]$ | $[90,95)$ | $[85,90)$ | $[80,85)$ | $[77,80)$ | $[73,77)$ | $[70,73)$ | $[67,70)$ | $[63,67)$ | $[60,63)$ | $[0,60)$ |
Input Format
Read data from standard input.
The first line contains a positive integer $n$, the number of freshman students.
The next $n$ lines each describe one student (given in lexicographical order of student ID), with items separated by spaces. The data for one student include:
- A positive integer $p$ of length $10$ (guaranteed to have no leading zeros), representing the student ID of the $i$-th student.
- A character, M or F. M means the $i$-th student is male, and F means the $i$-th student is female.
- A non-negative integer $s$ between $0$ and $50$, representing the course-specific score of the $i$-th student.
- A string in the form `a'b"` indicating that the $i$-th student’s final long run test time is $a$ minutes $b$ seconds.
- A character, P or F. P means the $i$-th student passes the physical fitness test, and F means the $i$-th student does not pass.
- A non-negative integer $f$ between $0$ and $5$, representing the final assessment score of the $i$-th student in the “Freshman Special Program.”
- A non-negative integer $c$, representing the number of times the $i$-th student participated in the “Class Training Camp.”
The next line contains a non-negative integer $m$, the number of “Sunshine Long Run” records that need to be filtered.
The next $m$ lines each describe one “Sunshine Long Run” record to be filtered (given in order of start time), with items separated by spaces. Each record includes:
- A string in the form `2017MMDD`, representing the completion date of the $j$-th record.
- A positive integer $p$ of length $10$ (guaranteed to have no leading zeros), representing the source student ID of the $j$-th record.
- Two strings in the form `hh:mm:ss`, representing the start time and end time of the $j$-th record, respectively.
- A non-negative floating-point number $l$ accurate to two digits after the decimal point, representing the exercise distance of the $j$-th record in kilometers.
- A string in the form `a'b"` indicating that the total pause time of the $j$-th record is $a$ minutes $b$ seconds.
- A non-negative integer $s$, representing the total number of steps of the $j$-th record.
The input format can be referred to in the sample file provided.
Output Format
Output to standard output.
The output contains $n$ lines. Please output, in **lexicographical order** of student ID, each student’s student ID, overall score on a percentage scale, and grade. Each student occupies one line, with items separated by spaces.
Explanation/Hint
For $100\%$ of the testdata, $n\le 10^4,0\le a,b\le 59,0\le c\le 100,m\le 1.5\times 10^5,0\le l\le 100,0\le s\le 10^6$。
#### Copyright Information
From THUPC (THU Programming Contest) 2017.
Translated by ChatGPT 5