用叉积确定点在直线的左半区还是右半区,用状态压缩map<string,int>Q;
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;
struct point
{
long long x,y;//坑死,改成int超时,longlong就没事,他大爷
point(long long x=0,long long y=0):x(x),y(y){};
};
//typedef point Vector;
inline point operator - (point a1,point b1)
{
return point(a1.x-b1.x,a1.y-b1.y);
}
bool cross(point a1,point b1)
{
return a1.x*b1.y>a1.y*b1.x;
}
inline int bd(point a1,point b1,point c1)
{
return cross(b1-a1,c1-a1);
}
map<string,int>Q;
point a[55555],b[55555],c[55][2];
int main()
{
int T,N,M,K,i,j;
scanf("%d",&T);
while(T--)
{
Q.clear();
scanf("%d%d%d",&N,&M,&K);
for(i=0;i<N;i++)
scanf("%d%d",&a[i].x,&a[i].y);
for(i=0;i<M;i++)
scanf("%d%d",&b[i].x,&b[i].y);
for(i=0;i<K;i++)
scanf("%d%d%d%d",&c[i][0].x,&c[i][0].y,&c[i][1].x,&c[i][1].y);
for(i=0;i<M;i++)
{
string s="";
for(j=0;j<K;j++)
{
if(bd(c[j][0],c[j][1],b[i]))
s+="1";
else
s+="0";
}
s+="";
Q[s]=1;
}
for(i=0;i<N;i++)
{
string s="";
for(j=0;j<K;j++)
{
if(bd(c[j][0],c[j][1],a[i]))
s+="1";
else
s+="0";
}
s+="";
if(Q[s]==1)
printf("1\n");
else
printf("0\n");
}
}
}