Cod sursa(job #2961627)

Utilizator LucaMuresanMuresan Luca Valentin LucaMuresan Data 6 ianuarie 2023 19:27:00
Problema Amlei Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.98 kb
#include <bits/stdc++.h>

using namespace std;

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

void solve()
{
    int n, t, u;
    in >> n >> t >> u;

    set<vector<int>>st;

    for (int i=1; i<=t; i++)
    {
        vector<int>v;
        v.clear();

        for (int j=1; j<=n; j++)
        {
            int x;
            in >> x;

            v.push_back(x);
        }

        sort(v.begin(), v.end());

        st.insert(v);
    }

    for (int i=1; i<=u; i++)
    {
        vector<int>v;
        v.clear();

        for (int j=1; j<=n; j++)
        {
            int x;
            in >> x;
            v.push_back(x);
        }

        sort(v.begin(), v.end());

        if (st.find(v) != st.end())
        {
            st.erase(v);
        }

    }

    if (st.empty())
        out << "DA\n";
    else
        out << "NU\n";
}

int main()
{
    int t;
    in >> t;

    while (t--)
        solve();

    return 0;
}