Pagini recente » Cod sursa (job #2852755) | Cod sursa (job #2346116) | Cod sursa (job #545209) | Cod sursa (job #2735276) | Cod sursa (job #39252)
Cod sursa(job #39252)
type punct=record
x,y:integer;
end;
dreapta=record
a,b,c:integer;
end;
var n,m,count:integer;
dr:array [1..1000] of dreapta;
pu:array [1..1000] of punct;
tip,sus,jos,unde:array [0..1000] of integer;
procedure citire;
var i:integer;
begin
assign(input,'regiuni.in');
reset(input);
readln(n,m);
for i:=1 to n do
readln(dr[i].a,dr[i].b,dr[i].c);
for i:=1 to m do
readln(pu[i].x,pu[i].y);
close(input);
end;
function ecuatie(i,j:integer):longint;
begin
ecuatie:=dr[i].a*pu[j].x+dr[i].b*pu[j].y+dr[i].c;
end;
procedure prel;
var i,j:integer;
begin
for i:=1 to n do
begin
fillchar(sus,sizeof(sus),0);
fillchar(jos,sizeof(jos),0);
fillchar(unde,sizeof(unde),0);
for j:=1 to m do
if ecuatie(i,j)>0
then begin
inc(sus[tip[j]]);
unde[j]:=1;
end
else begin
inc(jos[tip[j]]);
unde[j]:=-1;
end;
for j:=1 to m do
if unde[j]=-1
then inc(tip[j],sus[tip[j]]);
end;
fillchar(unde,sizeof(unde),0);
for i:=1 to m do
unde[tip[i]]:=1;
for i:=0 to m do
count:=count+unde[i];
end;
begin
citire;
prel;
assign(output,'regiuni.out');
rewrite(output);
writeln(count);
close(output);
end.