#P7426. Calculation of College Freshman Physical Education Grades

    ID: 20621 Type: Default 1000ms 256MiB

Calculation of College Freshman Physical Education Grades

Calculation of College Freshman Physical Education Grades

For a freshman, the final physical education score is composed of five parts:

  1. PE Special Score (given directly by the teacher, maximum (50)).
  2. Long Run Test Score (maximum (20)). This is based on a long run test where males run (3000) m and females run (1500) m. The scoring is determined by the test time as follows:
    [ \text{For males: }\begin{array}{c|cccccccccc} \text{Score} &20 & 18 & 16 & 14 & 12 & 10 & 8 & 6 & 4 & 2\ \text{Time (s)} &\leq750 & \leq780 & \leq810 & \leq840 & \leq870 & \leq910 & \leq950 & \leq990 & \leq1030 & \leq1080 \end{array} ] [ \text{For females: }\begin{array}{c|cccccccccc} \text{Score} &20 & 18 & 16 & 14 & 12 & 10 & 8 & 6 & 4 & 2\ \text{Time (s)} &\leq400 & \leq417 & \leq434 & \leq451 & \leq470 & \leq485 & \leq500 & \leq515 & \leq530 & \leq540 \end{array} ]
  3. "Sunshine Long Run" Score (maximum (10)). This score is based on the number of valid extracurricular run records recorded by a smartphone app. A run record is considered valid if all of the following conditions are met:
    • Distance \(\geq3000\) m for males and \(\geq1500\) m for females.
    • Average speed (distance/(end time - start time)) is between \(2\) and \(5\) m/s (inclusive).
    • Total pause time is at most \(4\) minutes 30 seconds (\(270\) s).
    • Average stride (distance/steps) is at most \(1.5\) m.
    • The start time of a record is at least \(6\) hours (\(21600\) s) after the end time of the previous valid record.
    The number of valid records is then mapped to a score as follows:
    \[ \begin{array}{c|ccccccc} \text{Score} &10 & 9 & 8 & 7 & 6 & 4 & 2\\ \text{Valid Runs} & [21,\infty) & [19,20] & [17,18] & [14,16] & [11,13] & [7,10] & [3,6] \end{array} \]
  4. Physical Fitness Test: If the student passes, they receive (10) points; otherwise, (0) points.
  5. First-year Special Plan (maximum (10)) is composed of two parts:
    • Attendance Score (\(5\) points): The total attendance is the sum of the number of class training camp attendances and the number of valid "Sunshine Long Run" records. The attendance score is determined as follows:
    \[ \begin{array}{c|ccccc} \text{Attendance Score} &5 & 4 & 3 & 2 & 1\\ \text{Total Attendance} &[18,\infty) & [15,17] & [12,14] & [9,11] & [6,8] \end{array} \]
    • Final Test Score (\(5\) points): Provided directly.

The final total score is the sum of these parts (maximum (100)). Based on the percentage score, the grade is assigned as follows: [ \begin{array}{c|ccccccccccc} \text{Grade} & A & A- & B+ & B & B- & C+ & C & C- & D+ & D & F \ \text{Score Range} & [95,100] & [90,95) & [85,90) & [80,85) & [77,80) & [73,77) & [70,73) & [67,70) & [63,67) & [60,63) & [0,60) \end{array} ]

You are given multiple test cases. For each test case, compute the final score and determine the corresponding grade letter.

inputFormat

The input begins with an integer (T) ((1 \leq T \leq 100)) representing the number of test cases. Each test case is provided in the following format:

Line 1: A character representing the student's gender ('M' for male, 'F' for female).

Line 2: Five space-separated integers:

  • PE Special Score (0 to 50).
  • Long Run Test time in seconds (an integer).
  • Physical Fitness Test result (1 for pass, 0 for fail).
  • Number of class training camp attendances (an integer).
  • Final Test Score for the First-year Special Plan (0 to 5).

Line 3: An integer (N) denoting the number of "Sunshine Long Run" records.

The next (N) lines: Each line contains five space-separated integers representing one run record:

  • Start time (in seconds), End time (in seconds), Distance (in meters), Total pause time (in seconds), and Number of steps.

Notes:

  • Run records are provided in chronological order (non-decreasing start times).
  • Use the provided criteria and mappings to compute each sub-score, sum them for the total score, and map the total score to a letter grade.

outputFormat

For each test case, output a single line containing two items separated by a space: the total physical education score (an integer) and the corresponding grade letter.

sample

3
M
45 740 1 10 4
3
0 800 3000 200 2000
90000 90800 3100 100 2100
91000 91800 2900 100 1900
F
50 410 0 17 5
4
0 600 1500 200 1000
40000 40600 1600 100 1100
41000 41600 1700 50 1200
70000 70600 1600 0 1050
M
40 800 1 20 3
5
0 800 3000 100 2100
30000 30800 3200 100 2200
60000 60800 3100 200 2100
90000 90800 3000 100 2000
120000 120800 3000 100 2000
82 B

80 B 76 C+

</p>