我们注意到 存在的充要条件是存在 ,使得 。
发现值域很小,直接做就好了。
#include <bits/stdc++.h>
#define lb(x) (x&-x)
#define L(i,j,k) for(int i=(j);i<=(k);++i)
#define R(i,j,k) for(int i=(j);i>=(k);--i)
using namespace std;
using i64 = long long;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
void chmin(int &x, int c) {x = min(x, c);}
void chmax(int &x, int c) {x = max(x, c);}
const int maxn = 3e5 + 10, mod = 998244353;
int N, A[maxn], cnt[maxn];
void solve() {
cin >> N;
L (i, 1, N) cin >> A[i];
for (int S = 2; S <= 1000; S += 2) {
for (int D = 0; D <= S / 2; D ++ ) {
L (i, 1, N) cnt[A[i]] ++;
vector<int> res; res.clear();
if (cnt[S / 2] == 0) {
res.push_back (S / 2);
} else cnt[S / 2] -- ;
if (cnt[3 * S / 2] == 0) {
res.push_back (3 * S / 2);
} else cnt[3 * S / 2] -- ;
if (cnt[S - D] == 0) {
res.push_back (S - D);
} else cnt[S - D] -- ;
if (cnt[S + D] == 0) {
res.push_back (S + D);
} else cnt[S + D] -- ;
if ((int)res.size() == 4 - N) {
cout << "YES\n";
for (int x : res) cout << x << '\n';
return ;
}
L (i, 1, N) cnt[A[i]] = 0;
}
}
cout << "NO\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
while (T--)solve();
return 0;
}
// 常年玩柚子社的人都目光炯炯有神,非常自信,且智商逐年上升,最后完全成为天才。
// 玩柚子社会改造身体结构,预防各种不治之症。
// 人一旦开始玩柚子社就说明这个人的智慧品行样貌通通都是上等,这辈子都能在任何地方风姿飒爽。
// 柚子厨具有强烈的社会正义感,对治安稳定有巨大的贡献,保护普通人的生命。