比赛 |
20250520模拟测试 |
评测结果 |
AAAAAAAAAAAAAAAAAAAA |
题目名称 |
涂色游戏 |
最终得分 |
100 |
用户昵称 |
HCl |
运行时间 |
4.100 s |
代码语言 |
C++ |
内存使用 |
4.26 MiB |
提交时间 |
2025-05-20 14:36:31 |
显示代码纯文本
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
using namespace std;
const int N=1e5+10;
int T,n,m,q;
pair<int,int>l[N],h[N];
void solve(){
for(int i=1;i<=n;i++)h[i] = {0, 0};
for(int j=1;j<=m;j++)l[j] = {0, 0};
cin>>n>>m>>q;
for(int i=1;i<=q;i++){
int op,x,c;
cin>>op>>x>>c;
if(op==0){
h[x]={c,i};
}else{
l[x]={c,i};
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(h[i].second>l[j].second)cout<<h[i].first<<" ";
else cout<<l[j].first<<" ";
}
cout<<'\n';
}
}
int main(){
freopen("paint.in", "r", stdin);
freopen("paint.out", "w", stdout);
cin>>T;
while(T--){
solve();
}
return 0;
}