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