比赛 20250520模拟测试 评测结果 AAAAAAAAAAAAAAAAAAAA
题目名称 涂色游戏 最终得分 100
用户昵称 NahidaOI 运行时间 4.628 s
代码语言 C++ 内存使用 34.17 MiB
提交时间 2025-05-20 14:13:27
显示代码纯文本
#include<bits/stdc++.h>
#define int long long
#define Sangonomiya signed
#define Kokomi main()
#define Love return
#define Nahida 0
#define Forever ;
#define IOS cin.tie(nullptr)->sync_with_stdio(false)
#define cin std::cin
#define cout std::cout
const int N=1e6;
int T;
int n,m,q;
struct node{
    int col,num;
};
node hang[N],lie[N];
Sangonomiya Kokomi{
	freopen("paint.in","r",stdin);
    freopen("paint.out","w",stdout);
	cin>>T;
	while(T--){
        memset(hang,0,sizeof(hang));
        memset(lie,0,sizeof(lie));
		cin>>n>>m>>q;
        for(int i=1;i<=q;i++){
            int opt,x,c;
            cin>>opt>>x>>c;
            if(opt==0){
                hang[x].col=c;
                hang[x].num=i;
            }else{
                lie[x].col=c;
                lie[x].num=i;
            }
        }
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                if(hang[i].num>lie[j].num){
                    cout<<hang[i].col<<' ';
                }else{
                    cout<<lie[j].col<<' ';
                }
            }
            cout<<'\n';
        }
	}
	Love Nahida Forever;
}