1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| #include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+10; int n,q,a[MAXN],c[MAXN],p[MAXN],maxn[MAXN]; int main(){ cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } cin>>q; for(int i=1;i<=q;i++) { int op,x,y; cin>>op; if(op==1) { cin>>x>>y; c[x]=y; p[x]=i; } else cin>>maxn[i]; } for(int i=q-1;i>=1;i--) { maxn[i]=max(maxn[i], maxn[i+1]); } for(int i=1;i<=n;i++) { if(p[i]) cout<<max(c[i], maxn[p[i]])<<" "; else cout<<max(maxn[1], a[i])<<" "; } return 0; }
|