比赛 |
20250520模拟测试 |
评测结果 |
AAAAAAAAAAAAAAAAAAAA |
题目名称 |
涂色游戏 |
最终得分 |
100 |
用户昵称 |
Tim |
运行时间 |
2.257 s |
代码语言 |
C++ |
内存使用 |
5.23 MiB |
提交时间 |
2025-05-20 15:05:27 |
显示代码纯文本
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5;
struct node {
int time, color;
};
node col[N], row[N]; //row:行 col:列
int T;
signed main() {
freopen("paint.in", "r", stdin);
freopen("paint.out", "w", stdout);
scanf("%lld", &T);
while (T--) {
int n, m, q;
scanf("%lld%lld%lld", &n, &m, &q);
for (int opt, x, c, i = 1; i <= q; i++) {
scanf("%lld%lld%lld", &opt, &x, &c);
if (opt == 0)
for (int j = 1; j <= m; j++) col[x].color = c, col[x].time = i;
else
for (int j = 1; j <= n; j++) row[x].color = c, row[x].time = i;
}
for (int i = 1; i <= n; i++) {//行
for (int j = 1; j <= m; j++) { //列
if (col[i].time > row[j].time)
printf("%lld ", col[i].color);
else
printf("%lld ", row[j].color);
}
putchar('\n');
}
for (int i = 1; i <= max(m, n); i++)
row[i].time = 0, row[i].color = 0, col[i].time = 0, col[i].color = 0;
}
return 0;
}