我的代码
#include <iostream>
using namespace std;
int main() {
int n, m, q;
cin >> n >> m >> q;
int i;
int t, x, y;
int matrix[500][500] = {0};
int j;
for (i = 1; i <= q; i++) {
cin >> t >> x >> y;
if (t == 1) {
for (j = 0; j <= m - 1; j++){
matrix[x - 1][j] = y;
}
}else {
for (j = 0; j <= n - 1; j++) {
matrix[j][x - 1] = y;
}
}
}
//输出
int k;
for (i = 0; i <= n - 1; i++) {
for (k = 0; k <= m - 1; k++) {
cout << matrix[i][k] << " ";
if (k == m - 1)
cout << endl;
}
}
return 0;
}
oj系统显示我超时