过不了样例,但是AC了
查看原帖
过不了样例,但是AC了
744409
rainbowe楼主2024/11/29 17:19

样例第二组

  • 3 2 2
  • 3 0 0
  • 3 1 1

我的输出是

  • 3 0 0
  • 3 0 0
  • 3 1 1
#include<bits/stdc++.h>
using namespace std;
int t,n,m,q;
int x,c,o;
int h[100005],l[100005];
int cnth[100005],cntl[100005],cnt;
void work()
{
	cin>>n>>m>>q;
	cnt=0;
	memset(h,0,sizeof(h));
	memset(l,0,sizeof(l));
	memset(cnth,0,sizeof(cnth));
	memset(cntl,0,sizeof(cntl));
	while(q--)
	{
		cin>>o>>x>>c;
		x--;
		if(!o) l[x]=c,cntl[x]=cnt;
		else h[x]=c,cnth[x]=cnt;
		cnt++;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(cntl[i]>cnth[j]) cout<<l[i];
			else cout<<h[j];
			putchar(' ');
		}
		cout<<endl;
	}
}
int main()
{
	cin>>t;
	while(t--)
	{
		work();
	}
	return 0;
}
2024/11/29 17:19
加载中...