//Let's join Kaede Takagaki Fan Club !! #include #include #include using namespace std; typedef long long ll; typedef pair P; typedef pair P1; typedef pair P2; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 1000000000 #define fi first #define sc second #define rep(i,x) for(int i=0;i void dmp(T a){ rep(i,a.size()) cout << a[i] << " "; cout << endl; } template bool chmax(T&a, T b){ if(a < b){ a = b; return 1; } return 0; } template bool chmin(T&a, T b){ if(a > b){ a = b; return 1; } return 0; } template void g(T &a){ cin >> a; } template void o(const T &a,bool space=false){ cout << a << (space?' ':'\n'); } //ios::sync_with_stdio(false); const ll mod = 1000000007;//998244353 template void add(T&a,T b){ a+=b; if(a >= mod) a-=mod; } #define SZ 1000000 bitsetcur, nxt, nxt2; int n,a[150005]; P fr[SZ*2+5]; int main(){ ios::sync_with_stdio(false); g(n); repn(i,n) g(a[i]); cur[SZ] = 1; fr[SZ] = mp(0, 0); auto output=[&](vector

vi){ vectorans(n+1); repn(i,n) ans[i] = 0; rep(i,vi.size()) ans[vi[i].fi] = a[vi[i].fi] * vi[i].sc; repn(i,n) o(ans[i], 1); cout<<'\n'; return; }; repn(i,n){ //cout << i << endl; if(cur[SZ-a[i]]){ //cout << i << endl; vector

ans; ans.pb(mp(i, 1)); int cur = SZ-a[i]; //cout << fr[cur].fi << " " << fr[cur].sc << endl; while(cur != SZ){ P k = fr[cur]; ans.pb(mp(k.fi, k.sc)); cur -= k.sc * a[k.fi]; } o("Yes"); output(ans); return 0; } if(cur[SZ+a[i]]){ vector

ans; ans.pb(mp(a[i], -1)); int cur = SZ+a[i]; while(cur != SZ){ P k = fr[cur]; ans.pb(mp(k.fi, k.sc)); cur -= k.sc * a[k.fi]; } o("Yes"); output(ans); return 0; } nxt = cur | (cur << a[i]); nxt ^= cur; for(int ii=nxt._Find_first();ii< nxt.size();ii = nxt._Find_next(ii)){ fr[ii] = mp(i, 1); //cout << ii << " " << i << " " << 1 << endl; } nxt ^= cur; nxt2 = nxt | (cur >> a[i]); nxt2 ^= nxt; for(int ii=nxt2._Find_first();ii