Codeforces Round 278 (Div. 2)
B
Candy Boxes
Codeforces
1900
原题
← AC →
翻译中…

There is an old tradition of keeping $4$ boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set ${*x*_{1}, *x*_{2}, *x*_{3}, *x*_{4}}$ ($*x*_{1} ≤ *x*_{2} ≤ *x*_{3} ≤ *x*_{4}$) arithmetic mean is image, median is image and range is $*x*_{4} - *x*_{1}$. The arithmetic mean and median are not necessary integer. It is well-known that if those three numbers are same, boxes will create a "debugging field" and codes in the field will have no bugs.

翻译中…

For example, $1, 1, 3, 3$ is the example of $4$ numbers meeting the condition because their mean, median and range are all equal to $2$.

翻译中…

Jeff has $4$ special boxes of candies. However, something bad has happened! Some of the boxes could have been lost and now there are only $*n*$ ($0 ≤ *n* ≤ 4$) boxes remaining. The $*i*$-th remaining box contains $*a*_{*i*}$ candies.

翻译中…

Now Jeff wants to know: is there a possible way to find the number of candies of the $4 - *n*$ missing boxes, meeting the condition above (the mean, median and range are equal)?

翻译中…

Input

翻译中…

The first line of input contains an only integer $*n*$ ($0 ≤ *n* ≤ 4$).

翻译中…

The next $*n*$ lines contain integers $*a*_{*i*}$, denoting the number of candies in the $*i*$-th box ($1 ≤ *a*_{*i*} ≤ 500$).

翻译中…

Output

翻译中…

In the first output line, print "YES" if a solution exists, or print "NO" if there is no solution.

翻译中…

If a solution exists, you should output $4 - *n*$ more lines, each line containing an integer $*b*$, denoting the number of candies in a missing box.

翻译中…

All your numbers $*b*$ must satisfy inequality $1 ≤ *b* ≤ 10^{6}$. It is guaranteed that if there exists a positive integer solution, you can always find such $*b*$'s meeting the condition. If there are multiple answers, you are allowed to print any of them.

翻译中…

Given numbers $*a*_{*i*}$ may follow in any order in the input, not necessary in non-decreasing.

翻译中…

$*a*_{*i*}$ may have stood at any positions in the original set, not necessary on lowest $*n*$ first positions.

翻译中…

Note

翻译中…

For the first sample, the numbers of candies in $4$ boxes can be $1, 1, 3, 3$. The arithmetic mean, the median and the range of them are all $2$.

翻译中…

For the second sample, it's impossible to find the missing number of candies.

翻译中…

In the third example no box has been lost and numbers satisfy the condition.

翻译中…

You may output $*b*$ in any order.

翻译中…

样例

Input #1
2
1
1
Output #1
YES
3
3
InputCopy OutputCopy
Input #2
3
1
1
1
Output #2
NO
InputCopy OutputCopy
Input #3
4
1
2
2
3
Output #3
YES
InputCopy OutputCopy
题目信息
题号
488B
时间限制
1 s
内存限制
256 MB
标签
暴力
构造
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。