求助!25分5AC,15RE
查看原帖
求助!25分5AC,15RE
974157
pyc186565楼主2024/8/17 17:48
#include <iostream>  
#include <cstdio>  
using namespace std;  
int t, m, n, q, opt, x, c;

int main() {  
	ios::sync_with_stdio(false);  
	//freopen("color.in", "r", stdin);
	//freopen("color.out", "w", stdout);  
	cin >> t;  
	while (t--) {  
		cin >> n >> m >> q;  
		int arr[n][m];  
		for (int a = 0; a < n; a++) {  
			for (int b = 0; b < m; b++)  
				arr[a][b] = 0;  
		}
		while (q--) {  
			cin >> opt >> x >> c;  
			if (opt == 0) {  
				for (int a = 0; a < n; a++)  
					arr[x-1][a] = c;  
			}
			if (opt == 1) {  
				for (int a = 0; a < m; a++)   
					arr[a][x-1] = c;  
			}  

		}  
		for (int a = 0; a < n; a++) {  
			for (int b = 0; b < m; b++)
				cout << arr[a][b] << " ";
			cout << endl;
		}

	}
	return 0;
}
2024/8/17 17:48
加载中...