CF439A.Devu, the Singer and Churu, the Joker

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Devu is a renowned classical singer. He is invited to many big functions/festivals. Recently he was invited to "All World Classical Singing Festival". Other than Devu, comedian Churu was also invited.

Devu has provided organizers a list of the songs and required time for singing them. He will sing nn songs, ithi^{th} song will take tit_{i} minutes exactly.

The Comedian, Churu will crack jokes. All his jokes are of 5 minutes exactly.

People have mainly come to listen Devu. But you know that he needs rest of 10 minutes after each song. On the other hand, Churu being a very active person, doesn't need any rest.

You as one of the organizers should make an optimal sсhedule for the event. For some reasons you must follow the conditions:

  • The duration of the event must be no more than dd minutes;
  • Devu must complete all his songs;
  • With satisfying the two previous conditions the number of jokes cracked by Churu should be as many as possible.

If it is not possible to find a way to conduct all the songs of the Devu, output -1. Otherwise find out maximum number of jokes that Churu can crack in the grand event.

输入格式

The first line contains two space separated integers nn , dd (1<=n<=100; 1<=d<=10000)(1<=n<=100; 1<=d<=10000) . The second line contains nn space-separated integers: t1,t2,...,tnt_{1},t_{2},...,t_{n} (1<=ti<=100)(1<=t_{i}<=100) .

输出格式

If there is no way to conduct all the songs of Devu, output -1. Otherwise output the maximum number of jokes that Churu can crack in the grand event.

输入输出样例

  • 输入#1

    3 30
    2 2 1
    

    输出#1

    5
    
  • 输入#2

    3 20
    2 1 1
    

    输出#2

    -1
    

说明/提示

Consider the first example. The duration of the event is 3030 minutes. There could be maximum 55 jokes in the following way:

  • First Churu cracks a joke in 55 minutes.
  • Then Devu performs the first song for 22 minutes.
  • Then Churu cracks 22 jokes in 1010 minutes.
  • Now Devu performs second song for 22 minutes.
  • Then Churu cracks 22 jokes in 1010 minutes.
  • Now finally Devu will perform his last song in 11 minutes.

Total time spent is 5+2+10+2+10+1=305+2+10+2+10+1=30 minutes.

Consider the second example. There is no way of organizing Devu's all songs. Hence the answer is -1.

首页