Cod sursa(job #23162)

Utilizator adi_nmAdrian Negreanu adi_nm Data 28 februarie 2007 12:50:10
Problema Amlei Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.58 kb
var n,t,u:integer;
    tt,tu,zero:array[-50..50]of integer;
    i,nr:integer;
    ok:boolean;
begin
  assign(input,'amlei.in'); reset(input);
  assign(output,'amlei.out'); rewrite(output);
  while not eof do begin
    readln(n,t,u); tt:=zero; tu:=zero;
    for i:=1 to n*t do begin
      read(nr); tt[nr]:=1;
    end;
    readln;
    for i:=1 to n*u do begin
      read(nr); tu[nr]:=1;
    end;
    readln;
    ok:=true; for i:=1 to n do ok:=ok and (tt[i]=tu[i]) and (tt[-i]=tu[-i]);
    if ok then writeln('DA') else writeln('NU');
  end;
  close(input); close(output);
end.