1 条题解
-
1
#include <bits/stdc++.h> using namespace std; const int MAXN = 100000, MAXM = 100000; int T; int n, m, q; int row[MAXN + 5], rowTime[MAXN + 5]; int col[MAXM + 5], colTime[MAXM + 5]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> T; while (T--) { cin >> n >> m >> q; for (int i = 1; i <= n; i++) row[i] = 0, rowTime[i] = 0; for (int i = 1; i <= m; i++) col[i] = 0, colTime[i] = 0; for (int i = 1; i <= q; i++) { int op, x, c; cin >> op >> x >> c; if (op == 0) { row[x] = c; rowTime[x] = i; } if (op == 1) { col[x] = c; colTime[x] = i; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (rowTime[i] > colTime[j]) cout << row[i] << " "; else cout << col[j] << " "; } cout << "\n"; } } return 0; }
- 1
信息
- ID
- 1234
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 5
- 标签
- 递交数
- 53
- 已通过
- 21
- 上传者