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

Сборники > Kovrov IT > задача:


50420 - Teachers Sightseeing

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

Задачи сборника

• 50407 - Missing Number
• 50337 - Exam Averages
• 50413 - Valid Permutations
• 50861 - The largest Student Group
• 50406 - Draw Pattern 178
• 50419 - The longest bitonic sequence
• 50492 - Contest Scoreboard
• 50418 - Student averages
• 50420 - Teachers Sightseeing
• 50445 - Cryptography
• 50516 - Lines
• 50446 - Snake
• 50875 - Take m-out
• 50786 - Top Question
• 50788 - Eight Puzzle
• 50509 - Reading Book
• 50529 - Row to Table

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

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

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

Teachers Sightseeing Tour in Konya

Question: A group of teachers go to Konya for sightseeing. After visiting for a while, they go to a restaurant for lunch. There are different types of foods there. Everyone has ordered different food with different prices. After the meal, everyone paid the money and then they left the restaurant. Group leader wants to know the total amount paid to the restaurant, and the list of all teachers from the most payers to the least payers. Write a program to make the teacher's job easier.

Input specification
On the first line types of food N(N ≤ 100), on the next line prices of the each food type (price ≤1000) with a single space, on the next line the number of teachers, on the next lines the name of the teacher and the following line the number of portion(s) of each food. If the food has not, there is written 0 (zero).

Output specification
on the first line show the total money spent, and on the following lines show the list of teachers from the most payers to the least payers. If the amount of the money paid by teachers is equal, show them in order of input.

 Sample Input I     Sample Input II   
 3
 50 100 150
 2
 Alban
 1 0 1
 Ylber
 0 2 1
 5
 10 20 30 40 50
 4
 Ali
 1 0 0 0 0
 Rovsen
 0 2 0 0 1
 Yusuf
 0 0 1 1 0
 Kilicbek
 1 1 1 1 1
 Sample Output I     Sample Output II   
 550
 Ylber
 Alban

 320
 Kilicbek
 Rovsen
 Yusuf
 Ali


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

www.contester.ru