Pagini recente » Cod sursa (job #336685) | Cod sursa (job #2448003) | Cod sursa (job #2901290) | Cod sursa (job #910658) | Cod sursa (job #18590)
Cod sursa(job #18590)
program amlei;
var a,b,c:array[0..505] of integer;
f,g:text; ok:boolean;
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; ok:=false;
for i:=1 to n*t do read(f,a[i]);
readln(f);
for i:=1 to n*t do read(f,b[i]);
readln(f);
for i:=1 to t do begin
x:=i*n;
for j:=x-n+1 to x do
if a[j]<0 then c[a[j]]:=0 else c[a[j]]:=1;
y:=1;
for j:=1 to u*t do begin
if b[j]<0 then if c[-b[j]]>0 then x:=0 else x:=1
else x:=c[b[j]];
y:=y and x;
if j mod n=0 then begin
if y=1 then ok:=true;
y:=1;
end;
end;
end;
if ok=true then writeln(g,'DA') else writeln(g,'NU');
end;
close(f); close(g);
end.