Cod sursa(job #2961622)

Utilizator Beverita2345Bretan Alexandru Beverita2345 Data 6 ianuarie 2023 19:24:36
Problema Amlei Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.79 kb
#include <bits/stdc++.h>

using namespace std;

ifstream in("amlei.in");
ofstream out("amlei.out");

set<int> s;
vector<int> v;
map<vector<int>, int> mt, mu;
int n, t, u;

void amlei(int val, map<vector<int>, int> &m) {
    for (int i = 1; i <= val; ++i) {
        s.clear();
        for (int j = 1; j <= n; ++j) {
            int x;
            in >> x;

            s.insert(x);
        }

        v.clear();

        for (auto it: s) v.emplace_back(it);

        m[v] = 1;
    }
}

int main() {
    while (in >> n >> t >> u) {
        mt.clear(), mu.clear();
        amlei(t, mt),amlei(u, mu);

        bool ok = 1;

        for (auto I: mu) mt[I.first]--;
        for (auto I: mt) if (I.second != 0) ok = 0;

        if (ok) out << "DA" << '\n';
        else out << "NU" << '\n';
    }
    return 0;
}