300740: CF140D. New Year Contest

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

New Year Contest

题意翻译

有一场跨年比赛从18:00举行到次日6:00。给定做每道题所需的时间,求最多能做多少道题目,以及在此基础上罚时最少是多少。一道题目的罚时是提交时间与零点的时间差;做完某道题目之后可以在任意时刻提交;做题过程中可以暂时去做别的事情 输入n(n<=100)道题目 接下来n个数a[i](a[i]小于等于720)

题目描述

As Gerald sets the table, Alexander sends the greeting cards, and Sergey and his twins create an army of clone snowmen, Gennady writes a New Year contest. The New Year contest begins at 18:00 (6.00 P.M.) on December 31 and ends at 6:00 (6.00 A.M.) on January 1. There are $ n $ problems for the contest. The penalty time for each solved problem is set as the distance from the moment of solution submission to the New Year in minutes. For example, the problem submitted at 21:00 (9.00 P.M.) gets penalty time 180, as well as the problem submitted at 3:00 (3.00 A.M.). The total penalty time is calculated as the sum of penalty time for all solved problems. It is allowed to submit a problem exactly at the end of the contest, at 6:00 (6.00 A.M.). Gennady opened the problems exactly at 18:00 (6.00 P.M.) and managed to estimate their complexity during the first 10 minutes of the contest. He believes that writing a solution for the $ i $ -th problem will take $ a_{i} $ minutes. Gennady can submit a solution for evaluation at any time after he completes writing it. Probably he will have to distract from writing some solution to send the solutions of other problems for evaluation. The time needed to send the solutions can be neglected, i.e. this time can be considered to equal zero. Gennady can simultaneously submit multiple solutions. Besides, he can move at any time from writing one problem to another, and then return to the first problem from the very same place, where he has left it. Thus the total solution writing time of the $ i $ -th problem always equals $ a_{i} $ minutes. Of course, Gennady does not commit wrong attempts, and his solutions are always correct and are accepted from the first attempt. He can begin to write the solutions starting from 18:10 (6.10 P.M.). Help Gennady choose from the strategies that help him solve the maximum possible number of problems, the one with which his total penalty time will be minimum.

输入输出格式

输入格式


The first line contains an integer $ n $ ( $ 1<=n<=100 $ ) — the number of the problems. The next line contains $ n $ space-separated integers $ a_{i} $ ( $ 1<=a_{i}<=720 $ ) — each number shows how much time in minutes Gennady will spend writing a solution to the problem.

输出格式


Print two integers — the number of problems Gennady will solve and the total penalty time considering that he chooses the optimal strategy.

输入输出样例

输入样例 #1

3
30 330 720

输出样例 #1

2 10

说明

In the sample, one of Gennady's possible optimal strategies is as follows. At 18:10 (6:10 PM) he begins to write the first problem and solves it in 30 minutes (18:40 or 6.40 P.M.). At 18:40 (6.40 P.M.) he begins to write the second problem. There are 320 minutes left before the New Year, so Gennady does not have the time to finish writing the second problem before the New Year. At 0:00 (12.00 A.M.) he distracts from the second problem, submits the first one, and returns immediately to writing the second problem. At 0:10 (0.10 A.M.), he completes the solution for the second problem, submits it and gets 10 minute penalty time. Note that as the total duration of the contest is 720 minutes and Gennady has already spent 10 minutes on reading the problems, he will not have time to solve the third problem during the contest. Yes, such problems happen to exist. Competitions by the given rules are held annually on the site http://b23.ru/3wvc

Input

题意翻译

有一场跨年比赛从18:00举行到次日6:00。给定做每道题所需的时间,求最多能做多少道题目,以及在此基础上罚时最少是多少。一道题目的罚时是提交时间与零点的时间差;做完某道题目之后可以在任意时刻提交;做题过程中可以暂时去做别的事情 输入n(n<=100)道题目 接下来n个数a[i](a[i]小于等于720)

加入题单

算法标签: