#include #define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) #define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i)) #define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i)) #define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i)) #define ALL(x) ::std::begin(x), ::std::end(x) using namespace std; vector solve(int n, const vector & a) { // find duplicated numbers unordered_map found; REP (i, n) { if (found.count(a[i])) { int j = found[a[i]]; vector x(n); x[i] = +1; x[j] = -1; return x; } found[a[i]] = i; } // dp unordered_map cur, prv; vector order(n); iota(ALL(order), 0); sort(ALL(order), [&](int i, int j) { return a[i] < a[j]; }); REP (i, n) { prv = cur; cur.try_emplace(a[i], i); for (auto it : prv) { cur.try_emplace(it.first + a[i], i); cur.try_emplace(it.first - a[i], i); } if (cur.count(0)) { break; } } if (not cur.count(0)) { return vector(); } // for (auto it : cur) { // cerr << it.first << " (" << it.second << ")" << endl; // } // reconstruct vector x(n); for (int64_t value = 0; ; ) { int i = cur[value]; if (value - a[i] == 0) { x[i] = +1; break; } else if (cur.count(value - a[i]) and cur[value - a[i]] < i) { x[i] = +1; value -= a[i]; } else if (cur.count(value + a[i]) and cur[value + a[i]] < i) { x[i] = -1; value += a[i]; } else { assert (false); } } return x; } // generated by online-judge-template-generator (https://github.com/kmyk/online-judge-template-generator) const string YES = "Yes"; const string NO = "No"; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); constexpr char endl = '\n'; int N; cin >> N; vector A(N); REP (i, N) { cin >> A[i]; } auto x = solve(N, A); if (x.empty()) { cout << NO << endl; } else { cout << YES << endl; REP (i, N) { cout << (A[i] * x[i]) << (i + 1 < N ? ' ' : '\n'); } } return 0; }