Pagini recente » Cod sursa (job #3258996) | Cod sursa (job #165857) | Cod sursa (job #2668021) | Cod sursa (job #45680) | Cod sursa (job #25649)
Cod sursa(job #25649)
var n,m,i,vr:integer;
a:array[1..1000] of 0..1;
c,tc:integer;
nrc,j:byte;
timp:longint;
f,g:text;
begin
assign(f,'aprindere.in'); reset(f);
assign(g,'aprindere.out'); rewrite(g);
readln(f,n,m);
for i:=0 to n-1 do read(f,a[i]);
readln(f);
timp:=0;
for i:=1 to m do begin
read(f,c,tc,nrc);
if a[c]=0 then begin
timp:=timp+tc;
for j:=1 to nrc do begin
read(f,vr);
a[vr]:=abs(a[vr]-1);
end;
end;
readln(f);
end;
write(g,timp);
close(g);
end.