HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN303 2013-15 Questions > problem:


50319 - Toll Plazas

CEN303 2013-15 Questions

Start: Dec.15.2013 at 02:00:00 PM
Finish: Dec.15.2013 at 07:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 50472 - Minimum Sum Triangle
• 50842 - Minimum Sum Triangle - DP
• 50319 - Toll Plazas
• 51000 - Book Index
• 50531 - File Decryption
• 50464 - From Tirana to Durres
• 13-Fall2-10. 50411 - Sum of the Lea...
• 13-Fall2-20. 50687 - Pascal Triangle - 2
• 13-Fall2-40. 50753 - Average of the...
• 13-Fall2-50. 50686 - The Container
• 14-Fall1-10. 50740 - Service Time - 1

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared By Ibrahim Mesecan.

Toll Plazas

On the highway, the toll plazas have been built. The company have a video survillance. The company wants a video controlled automatized system to control and compare the results taken from toll plazas.

There are n cars in a queue and distributed to 3 toll plazas. Every car has three information associated with: carID, serviceTime, paymentAmount. The cars enter to the left most empty toll plaza. They stay in service according to serviceTime information and pay the paymentAmount when they leave. After the leave of the current car from any toll plaza the first car in the queue enters in there.

Question: Write a program that is going to read the car entry information and calculate the sum of payments for all toll plazas.

Input specification
There is one number (n) at the beginning representing the number of cars in the queue where 1 ≤ n ≤ 1000. Each of the following n lines contains 3 integers: carID, serviceTime, paymentAmount; where 1 ≤ carID ≤ 10000, 1 ≤ serviceTime (in seconds) ≤ 20, and 1 ≤ paymentAmount ≤ 10.

Output specification
Show three integers which represent the sum of the payment amounts collected by each of the toll plazas.

Sample Input I
  5
  1 10 5
  2 4  4
  3 3  5
  4 3  6
  5 3  7
Sample Input II
  5
  1 5 5
  2 3 4
  3 4 5
  4 3 6
  5 3 7
Sample Output I
  5 11 11
Sample Output II
  5 10 12

Для отправки решений необходимо выполнить вход.

www.contester.ru