求助!实在不知道哪里错了
查看原帖
求助!实在不知道哪里错了
1526858
KokinbaitoZeta楼主2024/11/9 19:35

P9117 [春季测试 2023] 涂色游戏

#include <bits/stdc++.h>
using namespace std;

int n;
int m;
int q;
int T;
int mp[10005][10005];//[h][l];

struct op{
	int x;
	int c;
	bool opt;
	
}p[10005];

int main(){
	cin>>T;
	for(int a=1;a<=T;a++){
		memset(mp,0,sizeof(mp));
		cin>>n>>m>>q;
		for(int i=1;i<=q;i++){
			cin>>p[i].opt>>p[i].x>>p[i].c;
			
			p[i].x ++;
			
			if(!p[i].opt){
				for(int j=1;j<=m;j++){
					mp[p[i].x][j] = p[i].c;
				}
			}else{
				for(int j=1;j<=n;j++){
					mp[j][p[i].x] = p[i].c;
				}
			}
		}
		
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				cout<<mp[i][j]<<" ";
			}
			cout<<endl;
		}
	}
	
	
	return 0;
}
2024/11/9 19:35
加载中...