Pagini recente » Cod sursa (job #1997676) | Cod sursa (job #1624585) | Cod sursa (job #1091485) | Cod sursa (job #1103967) | Cod sursa (job #1110919)
#include <cstdio>
#include <algorithm>
#define P 1299811
using namespace std;
int N,M;
short a[1005],b[1005],c[1005],x[1005],y[1005],t[1005];
int main()
{
int i,j,cnt=0;
freopen ("regiuni.in","r",stdin);
freopen ("regiuni.out","w",stdout);
scanf("%d%d", &N,&M);
for(i=1;i<=N;++i)
scanf("%hd%hd%hd", &a[i],&b[i],&c[i]);
for(i=1;i<=M;++i)
scanf("%hd%hd", &x[i],&y[i]);
for(i=1;i<=N;++i)
for(j=1;j<=M;++j)
if(1LL*a[i]*x[j]+1LL*b[i]*y[j]+c[i]>0)
t[j]=(1LL*t[j]*10+1)%P;
else
t[j]=(1LL*t[j]*10+2)%P;
sort(t+1,t+M+1);
i=1;
while(i<=M)
{
++cnt;
++i;
while(i<=M && t[i]==t[i-1])
++i;
}
printf("%d\n", cnt);
return 0;
}