Cod sursa(job #2716919)

Utilizator Alex_tz307Lorintz Alexandru Alex_tz307 Data 5 martie 2021 22:20:36
Problema Amlei Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 1 kb
#include <bits/stdc++.h>
#define int long long

using namespace std;

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

int32_t main() {
    int N, T, U;
    while(fin >> N >> T >> U) {
        set<int> S1;
        for(int i = 0; i < T; ++i) {
            int mask = 0;
            for(int j = 0; j < N; ++j) {
                int x;
                fin >> x;
                if(x > 0)
                    mask |= (1LL << x);
            }
            S1.emplace(mask);
        }
        set<int> S2;
        for(int i = 0; i < U; ++i) {
            int mask = 0;
            for(int j = 0; j < N; ++j) {
                int x;
                fin >> x;
                if(x > 0)
                    mask |= (1LL << x);
            }
            S2.emplace(mask);
        }
        bool ok = true;
        for(const int &x : S1)
            if(!S2.count(x)) {
                ok = false;
                break;
            }
        fout << (ok ? "DA\n" : "NU\n");
    }
}