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

Разделы > Сортировка и последовательности > задача:


50740 - Service Time - 1

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

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

• 50447 - Swimming Contest - 2
• 50513 - Climbing Up the Stairs
• 50744 - The Smallest Perimeter
• 50743 - Total Scholarships Discount
• 50984 - Top m hardworking employees
• 50847 - The first m trains to leave
• 51002 - The most successful classes
• Word Puzzle
• 50740 - Service Time - 1
• 50750 - Service Time - 2
• 50347 - Selling Oranges
• 50758 - National Elections - Revisited
• 50754 - Team Standings
• 50358 - Series of Odd Numbers
• 50756 - Average of the Nth Student
• 50757 - National Elections - 1
• 50755- Top N Donors - 1

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Service Time - 1

Question: Bank Asia wants to change their current client service numerator system. In this system, the people will be assigned a priority according to their own customer priority and priority according to the operation they want to have. They are also assigned an approximate service time, according to operation they have.

Write a program that is going to read the information for the currently waiting people. Then, your program will decide waiting time for this newly coming client.

Input specification: In the first line, you will be given the information for a new client. Then in the second line, you are given an integer (n), the number of people currently waiting in the queue where 1 ≤ n ≤ 60000. Then, each of the following n lines contain information for a client. In every client information line you are given

  • The name of person: Names may be composed of only English letters and several strings ending with a semicolon ';'.
  • The priority of the client: an integer where 1 ≤ Priority ≤ 10000;
  • Service time: an integer between 0 and 50

Output specification
Show the waiting time of newly arrived client.
Note: If there are other people in the queue with the same priority, the new client is served after all.

 Sample Input I     Sample Output I   
 Erion Agolli; 8 4
 5
 Corey Cecil Hines; 6 4
 Leonard Afrim Osmani; 8 9
 Ervin Dervishi; 14 8
 Carlos Estrada; 3 6
 Anjeza Dardani; 11 5
 22

Explanation: There are three people who have higher or equal priority with the new customer:

  • It takes 9 minutes to serve Leonard Afrim Osmani.
  • It takes 8 minutes to serve Ervin Dervishi.
  • It takes 5 minutes to serve Anjeza Dardani
That makes 22 minutes waiting time for Erion Agolli.
Для отправки решений необходимо выполнить вход.

www.contester.ru