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

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


50525 - Ordering Pizza

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

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

• 50497 - Falling Bricks - Revisited
• 51002 - The most successful classes
• 50847 - The first m trains to leave
• 50669 - Area of an Irregular Polygon
• 50860 - Number of Student Certificates
• 50444 - n digit kth number divisible...
• 50865 - Apartment Building Adminis...
• 50531 - File Decryption
• 50525 - Ordering Pizza
• 50451 - Processing Cost
• 50470 - Close Pairs - Revised
• 50752 - Student Groups
• 50524 - Elevator
• 50751 - The biggest Minute
• 50468 - Draw Matrix - 2
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon

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

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

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

Ordering Pizza

You are asked to write a program for a pizza shop. They have a price list for the pizzas and they store the orders coming from clients in a file. In the evenings, they want to check for the balance.

Question: Write a program that will read the pizza information and calculate the daily balance.

Input specification
First, you will be given an integer (n) the number of pizza types. Then, in the following line, you are given n inetgers. The first number is the price of first type of pizza, etc.

Then starting from the third line, in every line, you are given the orders of a customer. Every line contains an integer (k) at the beginning, then you are given k pairs of numbers in that line. In every pair, the first number is the type of the pizza and the second number represent the amount ordered by the customer from this type. Every pair ends with a semicolon. And the file end with a negative number at the beginning of the line where 1 ≤ n ≤ 100, and 1 ≤ k ≤ 60 and there are at most 6000 customer information.

Output specification
Show two integers, total balance of the day and the Max amount from one customer.

Sample Input I
5
200 250 300 350 400
1 1 2;
4 4 4; 5 3; 1 1; 3 2;
2 2 3; 5 2;
2 3 4; 2 3;
-1
Sample Output I
7300 3400

Explanation: There are five types of Pizza and four customer information:

  • The first customer bought only one type of pizza: 200x2=400
  • The second customer bought 4 types of pizza: 350x4 + 400x3 + 200x1 + 300x2 = 3400
  • The third customer bought 2 types of pizza: 1550
  • The fourth customer bought 2 types of pizza: 1950
And so, the total is 7300 and the second client has bought the max amount with 3400.


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

www.contester.ru