「BZOJ2299」[HAOI2011] 向量

2014年12月17日4,5032

Description

给你一对数a,b,你可以任意使用(a,b), (a,-b), (-a,b), (-a,-b), (b,a), (b,-a), (-b,a), (-b,-a)这些向量,问你能不能拼出另一个向量(x,y)。

说明:这里的拼就是使得你选出的向量之和为(x,y)

Input

第一行数组组数t,(t<=50000)

接下来t行每行四个整数a,b,x,y  (-2*109<=a,b,x,y<=2*109)

Output

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

Sample Input

3
2 1 3 3
1 1 0 1
1 0 -2 3

Sample Output

Y
N
Y

题解

orz wulala

注意到题目中相当于有4种操作

x或y +-2a

x或y +-2b

x+a,y+b

x+b,y+a

而3,4操作最多用1次,枚举3,4使用或不使用然后裴蜀定理判定即可

 

avatar
0 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
0 Comment authors
Recent comment authors
  Subscribe  
提醒