Submission

Status:

PPPPP

Subtask/Task Score:

100/100

Score: 100

User: AbsolutelynotNortGlGFrFr

Problemset: ตาราง

Language: cpp

Time: 0.002 second

Submitted On: 2026-01-16 20:47:56

#include <bits/stdc++.h>
#define int long long
using namespace std;

int row[21], col[21], ans[21][21], n;

signed main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> row[i];
    }
    for (int i = 1; i <= n; i++) {
        cin >> col[i];
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (row[i] > col[j]) {
                ans[i][j] = col[j];
                row[i] -= col[j];
                col[j] = 0;
            }
            else {
                ans[i][j] = row[i];
                col[j] -= row[i];
                row[i] = 0;
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cout << ans[i][j] << " ";
        }
        cout << "\n";
    }
    return 0;
}