logo AlgoBeat OnlineJudge
登录 注册

#212690. [UOI 2020] Array Reduction

内存限制:512 MiB 时间限制:5000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Given an array consisting of integers. For one operation, you can choose position (), decrease by , and increase the value of all other elements () by .

Find the minimum number of operations needed to make all elements of the array less than or equal to zero (i.e., non-positive), or report that it is impossible to do so.

输入格式

The first line contains three integers , , (, ) --- the length of the array and the operation parameters.

The second line contains integers () --- the initial values of the array elements.

输出格式

Output a single integer --- the minimum number of operations needed to make all elements of the array less than or equal to zero. If it is impossible, output .

If it is possible, output integers (), which represent the number of operations performed on the element with index . Note that the equality must hold.

样例

样例输入 1

4 10 1
2 5 9 -4

样例输出 1

4
1 1 2 0 

样例输入 2

5 1 100
-1000 -1000 10 -1000 -1000

样例输出 2

10
0 0 10 0 0 

样例输入 3

2 1 1
1 0

样例输出 3

-1

数据范围与提示

  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) without additional constraints.