题目
我的代码TLE了
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m, k;
cin >> n >> m >> k;
vector<vector<int>> wall(n, vector<int>(m, 0));
for (int i = 0; i < k; i++) {
int x, y, z;
cin >> x >> y >> z;
if (x == 0) {
for (int j = 0; j < m; j++) {
wall[y - 1][j] = z;
}
} else {
for (int j = 0; j < n; j++) {
wall[j][y - 1] = z;
}
}
}
int blueCount = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (wall[i][j] == 1) {
blueCount++;
}
}
}
cout << blueCount << endl;
return 0;
}