HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN303 2013-15 Questions > problem:


14-FallResit-10. 50525 - Ordering Pizza

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

• 14-Fall1-40. 50683 - Parking Buses
• 14-Fall1-50. 50770 - Average Depth
• 14-Fall1-60. 50784 - Top Growing C...
• 14-Fall2-10. 50751 - The biggest Mi...
• 14-Fall2-20. 50794 - Writing Files Int...
• 14-Fall2-30. 50490 - Across the River
• 14-Fall2-40. 50772 - The Path of a N...
• 14-Fall2-50. 50681 - Center of a Series
• 14-FallResit-10. 50525 - Orderi...
• 14-FallResit-20. 50488 - Connecting...
• 15FE-01. 50851 - Repeated Numbers
• 15FE-01. 50838 - Balanced Numbers
• 15FE-04. 50997 - Dynamic Knights
• 15HW-10. 50826 - Olive Containers
• 15HW-30. 50828 - Arranging Time ...
• 15HW-40. 50676 - Cinema Millennium
• 15HW-40. 50829 - Decode an Image

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.
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