比赛 期末考试2 评测结果 AATEEETEET
题目名称 魔法 最终得分 20
用户昵称 赵飞羽 运行时间 5.344 s
代码语言 C++ 内存使用 89.17 MiB
提交时间 2026-02-10 12:01:52
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;

const int N = 5050, Q = 100050;
int n, m, k, q, a[N][N], op, x, y;
//bitset <Q> b[Q];

void solve1() {
    m = k;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= n; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 1; i <= q; i++) {
        cin >> op >> x >> y;
        if (op == 1) {
            m++;
            for (int j = 1; j <= n; j++) a[m][j] = max(a[x][j], a[y][j]);
        } else if (op == 2) {
            m++;
            for (int j = 1; j <= n; j++) a[m][j] = min(a[x][j], a[y][j]);
        } else cout << a[x][y] << "\n";
    }
}
//
//void solve2() {
//    for (int i = 1; i <= k; i++) {
//        for (int j = 1; j <= n; j++) {
//            cin >> x;
//            b[i][j] = (x == 2? true: false);
//        }
//    }
//    for (int i = 1; i <= q; i++) {
//        cin >> op >> x >> y;
//        if (op == 1) {
//            m++;
//            b[m] = (b[x] | b[y]);
//        } else if (op == 2) {
//            m++;
//            b[m] = (b[x] & b[y]);
//        } else cout << b[x][y] + 1 << "\n";
//    }
//}

signed main() {
    freopen("breeding.in", "r", stdin);
    freopen("breeding.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin >> n >> k >> q;
    solve1();
    return 0;
}