Pagini recente » Cod sursa (job #3242820) | Cod sursa (job #1985762) | Cod sursa (job #2178670) | Cod sursa (job #1476700) | Cod sursa (job #1803202)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("amlei.in");
ofstream fout("amlei.out");
typedef long long int ll;
const int NMax = 205;
const int LIM = 2e9;
int A[NMax];
int B[NMax];
inline int update(const int &n, const int &t, int v[]) {
int x;
for(int i = 1; i <= n * t; i++) {
fin >> x;
v[x + n]++;
}
}
inline bool gol(const int v[], const int &n) {
for(int i = 0; i <= 2 * n; i++) {
if(v[i] > 0) return false;
}
return true;
}
int main(){
ios::sync_with_stdio(false);
fin.tie(NULL);
int n, t, u;
while(fin >> n) {
fin >> t >> u;
memset(A, 0, sizeof(A));
memset(B, 0, sizeof(B));
update(n, t, A);
update(n, u, B);
for(int i = 0; i <= n * 2; i++) {
int aux = A[i];
A[i] -= B[i];
B[i] -= aux;
}
if(gol(A, n) || gol(B, n)) {
fout << "DA\n";
} else {
fout << "NU\n";
}
}
return 0;
}