Const Sz = 1000; var a: array [1..Sz] of integer; b: array [1..Sz] of integer; c: array [1..Sz] of integer; d: array [1..Sz] of integer; M: integer; N: integer; i: integer; k: integer;begin read(M); readln(N); for i:=1 to N do begin read(a[i]); readln(b[i]); if (a[i]<>0) then c[i]:=1 else c[i]:=0; end; for i:=1 to N do begin if(c[i]<>0) then begin for k:=1 to i do begin if(d[k]=0) then d[i]:=1; if (c[k]=i) then d[k]:=0; end; writeln(d[i]) end;end;end.
mishagoride885
23.12.2022
Const Sz = 1000; var a: array [1..Sz] of integer; b: array [1..Sz] of integer; c: array [1..Sz] of integer; d: array [1..Sz] of integer; M: integer; N: integer; i: integer; k: integer;begin read(M); readln(N); for i:=1 to N do begin read(a[i]); readln(b[i]); if (a[i]<>0) then c[i]:=1 else c[i]:=0; end; for i:=1 to N do begin if(c[i]<>0) then begin for k:=1 to i do begin if(d[k]=0) then d[i]:=1; if (c[k]=i) then d[k]:=0; end; writeln(d[i]) end;end;end.