知识点:

复合类型:

二维数组。

#include <iostream>
using namespace std;

int main() {
    int n, m;
    bool ret = true;

    cin >> n >> m;
    int arr1[n][m];
    int arr2[n][m];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> arr1[i][j];
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> arr2[i][j];
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (arr1[i][j] != arr2[i][j]) {
                ret = false;
                break;
            }
        }
        if (ret == false) {
            break;
        }
    }

    if (ret) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}