#C8382. Taco Loyalty Points Calculation

    ID: 52358 Type: Default 1000ms 256MiB

Taco Loyalty Points Calculation

Taco Loyalty Points Calculation

You are given the flight records of several passengers. Each record consists of a passenger's name followed by a colon and a list of flight distances (in kilometers). The loyalty points for each flight are awarded as follows:

  • For a flight distance less than 500 km, the passenger earns 10 points.
  • For a flight distance between 500 km and 999 km (inclusive), the passenger earns 20 points.
  • For a flight distance between 1000 km and 1999 km (inclusive), the passenger earns 50 points.
  • For a flight distance of 2000 km or more, the passenger earns 100 points.

Your task is to compute the total loyalty points for each passenger. If a passenger has no flight records after the colon, their total points should be 0.

The point function can be formally represented as:

\( P(d)=\begin{cases}10, & d<500\\20, & 500\le d\le 999\\50, & 1000\le d\le 1999\\100, & d\ge 2000\end{cases} \)

inputFormat

The first line contains an integer n, the number of passengers. The following n lines each contain the flight data for a passenger in the format:

Name: d1 d2 ... dk

If there are no flight distances provided after the colon, the passenger is considered to have taken no flights.

outputFormat

Output n lines, one for each passenger, in the same order as input. Each line should be in the format:

Name: total_points

where total_points is the sum of the loyalty points from all flights of that passenger.

## sample
3
Alice: 480 512 1230
Bob: 999 756 2300
Charlie: 1500 1501 4500
Alice: 80

Bob: 140 Charlie: 200

</p>