| The 2025 ICPC Asia Chengdu Regional Contest (The 4rd Universal Cup. Stage 4: Grand Prix of Chengdu) |
|---|
| Finished |
Panda is a gallery curator. To prepare for an art exhibition, he launched a painting collection activity, and has collected a lot of paintings.
There are $$$n$$$ people participating in the activity, numbered from $$$1$$$ to $$$n$$$. For each person $$$i$$$, the number of paintings submitted is $$$b_i$$$. The total number of paintings is $$$m = \sum_{i=1}^n b_i \gt 0$$$. The submission percentage $$$a_i$$$ of person $$$i$$$ is calculated as $$$a_i=\operatorname{round}\left(\frac{b_i}{m},2\right)\times 100\%$$$.
The function $$$\operatorname{round}(x,2)$$$ rounds the real number $$$x$$$ to two decimal places. If the third decimal digit of $$$x$$$ is $$$5$$$ or greater, it rounds up; otherwise, it rounds down. For example, $$$\operatorname{round}(1.14514,2)=1.15$$$, while $$$\operatorname{round}(1.14414,2)=1.14$$$.
One day, Panda woke up to find that all the paintings had been stolen, and he also forgot the total number of paintings, $$$m$$$. He needs your help to restore the possible number of paintings submitted by each participant $$$b_1, b_2, \dots, b_n$$$ using only the recorded submission percentages $$$a_1, a_2, \dots a_n$$$. If no valid submission scheme exists, you must inform him.
In simple terms, given an array of percentages $$$a = [a_1, a_2, \dots a_n]$$$, find a non-negative integer array $$$b = [b_1, b_2, \dots, b_n]$$$ such that $$$\sum_{i=1}^n b_i \gt 0$$$, and for all $$$i$$$:
$$$$$$a_i=\operatorname{round}\left(\frac{b_i}{\sum_{j=1}^n b_j},2\right)\times 100\%$$$$$$
or determine that no such array exists.
The first line contains an integer $$$T$$$ ($$$1\le T\le 2\times 10^5$$$), indicating the number of test cases.
For each test case, the first line contains an integer $$$n$$$ ($$$1\le n\le 2\times 10^5$$$), representing the number of people participating in the painting activity.
The second line contains $$$n$$$ non-negative integers $$$d_1, d_2, \dots, d_n$$$ ($$$0\le d_i\le 100$$$), where $$$a_i = \frac{d_i}{100}\times 100\%$$$.
It is guaranteed that the total sum of $$$n$$$ across all test cases does not exceed $$$2\times 10^5$$$.
For each test case, if there exists a satisfying array $$$b$$$, you should first output a line with $$$\texttt{Yes}$$$, followed by a line with $$$n$$$ non-negative integers $$$b_1, b_2, \dots, b_n$$$ ($$$0 \le b_i \le 10^9$$$, $$$\sum_{i=1}^n b_i \gt 0$$$) separated by spaces. Any valid solution is accepted.
If there is no valid solution, simply output a line with $$$\texttt{No}$$$. Either Yes or No is case-insensitive, which means you can print $$$\texttt{YeS}$$$, $$$\texttt{yEs}$$$, $$$\texttt{nO}$$$, etc.
3 4 25 25 25 25 5 25 25 25 26 0 3 0 0 1
Yes 1 1 1 1 Yes 25 25 25 26 0 No
| Name |
|---|


