ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Linear Data Structures: Arrays > задача:


50319 - Toll Plazas

Гость
• Вопросы к жюри (1)

Задачи раздела

• 51171 Question 3
• 51093 - rgb2gray
• 51165 Question 1
• 51175 Question 2
• 51092 - Even and Odd
• 51095 - Normal and Trace
• 50423 - Numbers square
• 50300 - Matrix
• 50319 - Toll Plazas
• 50977 - Gaussian Elimination
• 50380 - Sum of the Numbers in the ...
• 50318 - Product Info
• 50326 - Matrix Operations
• 50395 - Page "Like" Averages
• 50410 - Zero Padding
• 50329 - Draw Matrix-1
• 50337 - Exam Averages

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
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