0.0
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
//Mystery_Sky
//
#define M 201000
#define INF 0x3f3f3f3f
#define ll long long
inline int read()
{
int x=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
return x*f;
}
struct node{
int x, t;
}Q[M];
int n, q, a[M], c[M];
int max_r[M];
int main() {
// freopen("bill.in", "r", stdin);
// freopen("bill.out", "w", stdout);
n = read();
for(int i = 1; i <= n; i++) a[i] = read();
q = read();
int tot = 0;
for(int i = 1; i <= q; i++) {
int opt = read();
if(opt == 1) {
int p = read(), x = read();
a[p] = x;
c[p] = i;
}
else {
int x = read();
Q[++tot].t = i;
Q[tot].x = x;
}
}
if(tot == q - Q[1].t + 1) {//只在1后出现2
int maxx = -1;
for(int i = 1; i <= tot; i++) maxx = max(Q[i].x, maxx);
for(int i = 1; i <= n; i++) {
if(a[i] < maxx) a[i] = maxx;
printf("%d ", a[i]);
}
}
else {
int m = tot;
for(int i = q; i >= 1; i--) {
if(Q[m].t == i) {
max_r[i] = max(Q[m].x, max_r[i+1]);
m--;
}
else max_r[i] = max_r[i+1];
}
for(int i = 1; i <= n; i++) {
if(c[i] == 0) a[i] = max(a[i], max_r[1]);
else a[i] = max(a[i], max_r[c[i]]);
printf("%d ", a[i]);
}
}
return 0;
}
唯愿,青春不辜负梦想,未来星辰闪耀
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步