Pagini recente » Cod sursa (job #3269718) | Cod sursa (job #3217263) | Cod sursa (job #1011832) | Cod sursa (job #634693) | Cod sursa (job #18495)
Cod sursa(job #18495)
program amlei;
var a,b:array[0..505] of integer;
f,g:text;
i,x,y,j,u,t,n,z:longint;
begin
assign(f,'amlei.in'); reset(f);
assign(g,'amlei.out'); rewrite(g);
y:=1;
while not(eof(f)) do begin
readln(f,n,t,u); y:=1;
for i:=1 to n*t do begin
read(f,x);
if x>0 then x:=1 else x:=0;
y:=y and x;
if i mod n=0 then begin a[i div n]:=y; y:=1; end;
end;
readln(f);
for i:=1 to n*u do begin
read(f,x);
if x>0 then x:=1 else x:=0;
y:=y and x;
if i mod n=0 then begin b[i div n]:=y; y:=1; end;
end;
readln(f);
y:=a[1];
for i:=2 to t do y:=y or a[i];
z:=b[1];
for i:=2 to u do z:=z or b[i];
if z=y then writeln(g,'DA') else writeln(g,'NU');
end;
close(f); close(g);
end.