Pagini recente » Cod sursa (job #2537459) | Cod sursa (job #1713934) | Cod sursa (job #1187919) | Cod sursa (job #2814146) | Cod sursa (job #38094)
Cod sursa(job #38094)
const nmax= 1000;
type dr = record
a,b,c:longint;
end;
pc = record
x,y:longint;
end;
var lpc:array[1..nmax] of pc;
ldr:array[1..nmax] of dr;
a:array[1..nmax,1..nmax] of boolean; //false sub, true peste
n,m:integer;
procedure citire;
var i:integer;
begin
assign(input,'regiuni.in'); reset(input);
readln(n,m);
for i:=1 to n do
readln(ldr[i].a, ldr[i].b, ldr[i].c);
for i:=1 to m do
readln(lpc[i].x, lpc[i].y);
close(input);
end;
procedure calc;
var i,j:integer;
aux:longint;
begin
for i:=1 to m do
for j:=1 to n do
begin
aux:=lpc[i].x * ldr[j].a + lpc[i].y * ldr[j].b;
if aux < -ldr[j].c then
a[i,j]:=false
else a[i,j]:=true;
end;
end;
function ok (l1,l2:integer):boolean;
var i:integer;
begin
ok:=true;
for i:=1 to n do
if a[l1,i] <> a[l2,i] then
begin
ok:=false;
exit;
end;
end;
procedure afla;
var rez:longint;
i,j:integer;
k:boolean;
begin
rez:=0;
for i:=1 to m do
begin
k:=false;
for j:=1 to m do
if (i<>j) then
if ok(i,j) then
begin
k:=true;
break;
end;
if not k then inc(rez);
end;
assign(output,'regiuni.out'); rewritE(output);
writeln(rez);
close(output);
end;
begin
citire;
calc;
afla;
end.