Nu aveti permisiuni pentru a descarca fisierul grader_test35.in
Cod sursa(job #1803202)
Utilizator | Manghiuc Teodor-Florin eu3neuom | Data | 11 noiembrie 2016 09:19:33 |
---|---|---|---|
Problema | Amlei | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 1.07 kb |
#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;
}