302143: CF408A. Line to Cashier
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Line to Cashier
题意翻译
超市出口有 $n$ 个收银员,第 $i$ 个收银员的队列中一共排了 $k_i$ 个顾客,其中第 $i$ 个收银员的第 $j$ 个顾客购买了 $m_{i,j}$ 件商品。结账流程是: - 每件商品需要花 $5$ 秒钟扫描; - 扫描完某位顾客的全部商品后,需要花 $15$ 秒钟来付款和找零。 现在可以任选一个队列去排队,输出最少需要多少秒才能到达收银员面前。题目描述
Little Vasya went to the supermarket to get some groceries. He walked about the supermarket for a long time and got a basket full of products. Now he needs to choose the cashier to pay for the products. There are $ n $ cashiers at the exit from the supermarket. At the moment the queue for the $ i $ -th cashier already has $ k_{i} $ people. The $ j $ -th person standing in the queue to the $ i $ -th cashier has $ m_{i,j} $ items in the basket. Vasya knows that: - the cashier needs 5 seconds to scan one item; - after the cashier scans each item of some customer, he needs 15 seconds to take the customer's money and give him the change. Of course, Vasya wants to select a queue so that he can leave the supermarket as soon as possible. Help him write a program that displays the minimum number of seconds after which Vasya can get to one of the cashiers.输入输出格式
输入格式
The first line contains integer $ n $ ( $ 1<=n<=100 $ ) — the number of cashes in the shop. The second line contains $ n $ space-separated integers: $ k_{1},k_{2},...,k_{n} $ ( $ 1<=k_{i}<=100 $ ), where $ k_{i} $ is the number of people in the queue to the $ i $ -th cashier. The $ i $ -th of the next $ n $ lines contains $ k_{i} $ space-separated integers: $ m_{i,1},m_{i,2},...,m_{i,ki} $ ( $ 1<=m_{i,j}<=100 $ ) — the number of products the $ j $ -th person in the queue for the $ i $ -th cash has.
输出格式
Print a single integer — the minimum number of seconds Vasya needs to get to the cashier.
输入输出样例
输入样例 #1
1
1
1
输出样例 #1
20
输入样例 #2
4
1 4 3 2
100
1 2 2 3
1 9 1
7 8
输出样例 #2
100