Лимит времени 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.
Для отправки решений необходимо выполнить вход.
|