Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int main()
- {
- //cin.sync_with_stdio(false);
- //cout.sync_with_stdio(false);
- ll n=0, m=0, k=0, col, type, num;
- ll res=0;
- ll mas1[1001], mas2[100001]={};
- ll masc[10002] = {};
- ll mass[10002] = {};
- ll masc1[10002] = {};
- ll mass1[10002] = {};
- scanf("%d%d%d", &n, &m, &k);
- //cin >> n >> m >> k;
- for (ll i=1; i<=k; i++){
- scanf("%d%d%d", &type, &num, &col);
- //cin >> type >> num >> col;
- if (type==1){
- mass[num-1]=col;
- mass1[num-1]=i;
- }
- else{
- masc[num-1]=col;
- masc1[num-1]=i;
- }
- }
- for (ll i=0; i<n; i++){
- for (ll j=0; j<m; j++){
- if (mass1[i]+masc1[j]>0){
- if (mass1[i]>masc1[j])
- mas2[i*m+j]=mass[i];
- else
- mas2[i*m+j]=masc[j];
- }
- }
- }
- for (ll i=0; i<n; i++){
- for (ll j=0; j<m; j++){
- //printf("%d ", mas2[i*m+j]);
- cout << mas2[i*m+j] << ' ';
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement