#BZOJ2299. [HAOI2011]向量

[HAOI2011]向量

题目描述

<![endif]--><!--[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

<![endif]--> 给你一对数a,b,你可以任意使用(a,b), (a,-b), (-a,b), (-a,-b), (b,a), (b,-a), (-b,a), (-b,-a)这些向量,问你能不能拼出另一个向量(x,y)。 说明:这里的拼就是使得你选出的向量之和为(x,y)

输入格式

第一行数组组数t,(t<=50000) 接下来t行每行四个整数a,b,x,y  (-2109<=a,b,x,y<=2109)

输出格式

t行每行为Y或者为N,分别表示可以拼出来,不能拼出来

3

2 1 3 3

1 1 0 1

1 0 -2 3

Y

N

Y





f提示

样例解释:

第一组:(2,1)+(1,2)=(3,3)

第三组:(-1,0)+(-1,0)+(0,1)+(0,1)+(0,1)=(-2,3)

Source