Pagini recente » Cod sursa (job #1673428) | Cod sursa (job #1606780) | Cod sursa (job #2241123) | Cod sursa (job #1387648) | Cod sursa (job #37618)
Cod sursa(job #37618)
var f:text;
x,y,a,b,c:array[1..1000] of integer;
l:array[1..1000,1..34] of longint;
ex:array[1..1000] of boolean;
n,m,i,j,zn:integer;
t,o:longint;
function semn(x,y,a,b,c:integer):byte;
begin
if longint(x)*longint(a)+longint(y)*longint(b)+longint(c)
<0 then semn:=0 else semn:=1;
end;
function egal(i,j:integer):boolean;
var k:integer;
begin
egal:=false;
for k:=1 to n div 30 +1 do if l[i,k]<>l[j,k] then exit;
egal:=true;
end;
begin
assign(f,'regiuni.in'); reset(f);
readln(f,n,m);
for i:=1 to n do readln(f,a[i],b[i],c[i]);
for i:=1 to m do readln(f,x[i],y[i]);
close(f);
for i:=1 to m do
begin
t:=0;
for j:=1 to n do
begin
o:=semn(x[i],y[i],a[j],b[j],c[j]);
t:=(t shl 1)+o;
if (j mod 30=0) or (j=n) then
begin
if j mod 30=0 then l[i,j div 30]:=t
else l[i,j div 30+1]:=t;
t:=0;
end;
end;
end;
assign(f,'regiuni.out'); rewrite(f);
zn:=0;
fillchar(ex,sizeof(ex),0);
for i:=1 to m do
if not ex[i] then
begin
inc(zn);
ex[i]:=true;
for j:=i+1 to m do
if egal(i,j) then ex[j]:=true;
end;
writeln(f,zn);
close(f);
end.