80分WA3-6求调玄关
查看原帖
80分WA3-6求调玄关
1271613
A_W_Lee楼主2025/6/27 12:58
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
struct node
{
	int col,t;
};
node h[N],l[N];
int T,n,m,q,op,x,c;
void clear_mp()
{
	for(int i=1;i<=n;i++)
	{
		h[i].col=l[i].col=h[i].t=l[i].t=0;
	}
}
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>T;
	while(T--)
	{
		cin>>n>>m>>q;
		for(int i=1;i<=q;i++)
		{
			cin>>op>>x>>c;
			if(!op)
			{
				h[x].col=c,h[x].t=i;
			}
			else
			{
				l[x].col=c,l[x].t=i;
			}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(h[i].t>l[j].t) cout<<h[i].col<<' ';
				else cout<<l[j].col<<' ';
			}
			cout<<'\n';
		}
		clear_mp();
	}
	
	
	return 0;
}

救救孩子!

2025/6/27 12:58
加载中...