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;
}
posted @ 2019-11-12 21:57  Mystery_Sky  阅读(461)  评论(0编辑  收藏  举报