CF808C.Tea Party

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Polycarp invited all his friends to the tea party to celebrate the holiday. He has nn cups, one for each of his nn friends, with volumes a1,a2,...,ana_{1},a_{2},...,a_{n} . His teapot stores ww milliliters of tea ( w<=a1+a2+...+anw<=a_{1}+a_{2}+...+a_{n} ). Polycarp wants to pour tea in cups in such a way that:

  • Every cup will contain tea for at least half of its volume
  • Every cup will contain integer number of milliliters of tea
  • All the tea from the teapot will be poured into cups
  • All friends will be satisfied.

Friend with cup ii won't be satisfied, if there exists such cup jj that cup ii contains less tea than cup jj but a_{i}>a_{j} .

For each cup output how many milliliters of tea should be poured in it. If it's impossible to pour all the tea and satisfy all conditions then output -1.

输入格式

The first line contains two integer numbers nn and ww ( 1<=n<=1001<=n<=100 , ).

The second line contains nn numbers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 1<=ai<=1001<=a_{i}<=100 ).

输出格式

Output how many milliliters of tea every cup should contain. If there are multiple answers, print any of them.

If it's impossible to pour all the tea and satisfy all conditions then output -1.

输入输出样例

  • 输入#1

    2 10
    8 7
    

    输出#1

    6 4 
    
  • 输入#2

    4 4
    1 1 1 1
    

    输出#2

    1 1 1 1 
    
  • 输入#3

    3 10
    9 8 10
    

    输出#3

    -1
    

说明/提示

In the third example you should pour to the first cup at least 5 milliliters, to the second one at least 4, to the third one at least 5. It sums up to 14, which is greater than 10 milliliters available.

首页