Pagini recente » anti_avram_2 | Cod sursa (job #2193134) | Cod sursa (job #2915053) | Cod sursa (job #510198) | Cod sursa (job #2182236)
#include <bits/stdc++.h>
using namespace std;
ifstream in("amlei.in");
ofstream out("amlei.out");
set<long long> mst1, mst2;
int main(void) {
for (int n, p, q; in >> n >> p >> q; ) {
mst1.clear();
for (int i = 1; i <= p; ++i) {
long long x = 0;
for (int j = 1; j <= n; ++j) {
int aux;
in >> aux;
if (aux > 0)
x |= (1LL << aux);
}
mst1.insert(x);
}
mst2.clear();
for (int i = 1; i <= q; ++i) {
long long x = 0;
for (int j = 1; j <= n; ++j) {
int aux;
in >> aux;
if (aux > 0)
x |= (1LL << aux);
}
mst2.insert(x);
}
bool ok = true;
for (long long x : mst1)
if (mst2.find(x) == mst2.end())
ok = false;
out << (ok ? "DA\n" : "NU\n");
}
return 0;
}