Universal Cup Judging System

Universal Cup

时间限制: 1.0 s 内存限制: 1024 MB 总分: 100 可 Hack ✓
统计

Panda 是一位画廊策展人。为了准备一次艺术展览,他发起了一项画作征集活动,并收集了许多画作。

共有 $n$ 个人参与了该活动,编号从 $1$ 到 $n$。对于每个人 $i$,其提交的画作数量为 $b_i$。画作总数为 $m = \sum_{i=1}^n b_i > 0$。每个人 $i$ 的提交比例 $a_i$ 计算公式为 $a_i = \text{round}\left(\frac{b_i}{m}, 2\right) \times 100\%$。

函数 $\text{round}(x, 2)$ 将实数 $x$ 四舍五入保留两位小数。如果 $x$ 的第三位小数大于或等于 5,则向上舍入;否则向下舍入。例如,$\text{round}(1.14514, 2) = 1.15$,而 $\text{round}(1.14414, 2) = 1.14$。

一天,Panda 醒来发现所有的画作都被偷了,而且他也忘记了画作的总数 $m$。他需要你的帮助,仅根据记录的提交比例 $a_1, a_2, \dots, a_n$ 来恢复每个参与者可能提交的画作数量 $b_1, b_2, \dots, b_n$。如果不存在合法的提交方案,你必须告知他。

简单来说,给定一个比例数组 $a = [a_1, a_2, \dots, a_n]$,寻找一个非负整数数组 $b = [b_1, b_2, \dots, b_n]$,满足 $\sum_{i=1}^n b_i > 0$,且对于所有 $i$:

$$a_i = \text{round}\left(\frac{b_i}{\sum_{j=1}^n b_j}, 2\right) \times 100\%$$

或者确定不存在这样的数组。

输入格式

第一行包含一个整数 $T$ ($1 \le T \le 2 \times 10^5$),表示测试用例的数量。

对于每个测试用例,第一行包含一个整数 $n$ ($1 \le n \le 2 \times 10^5$),表示参与画作征集活动的人数。

第二行包含 $n$ 个非负整数 $d_1, d_2, \dots, d_n$ ($0 \le d_i \le 100$),其中 $a_i = \frac{d_i}{100} \times 100\%$。

保证所有测试用例中 $n$ 的总和不超过 $2 \times 10^5$。

输出格式

对于每个测试用例,如果存在满足条件的数组 $b$,你应当首先输出一行 Yes,接着输出一行由空格隔开的 $n$ 个非负整数 $b_1, b_2, \dots, b_n$ ($0 \le b_i \le 10^9$,$\sum_{i=1}^n b_i > 0$)。任何合法的解都将被接受。

如果不存在合法的解,只需输出一行 NoYesNo 均不区分大小写,这意味着你可以输出 YeSyEsnO 等。

样例

输入样例 1

3
4
25 25 25 25
5
25 25 25 26 0
3
0 0 1

输出样例 1

Yes
1 1 1 1
Yes
25 25 25 26 0
No

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.