TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

You are given M axis parallel right angled triangles ( one side on the x-axis and the other on y-axis ) with one vertex as origin. You are also provided with the co-ordinates of N candies in the plane. State for each triangle if there is atleast one candy which lies inside the triangle.Assume that no candy lies on the triangle.

Input Format

First line of input contains t - the number of test cases.
For each test case, the first line contains two numbers N ( number of candies) and M (number of triangles). Then follow N lines each containing 2 space separated integer denoting the x and y co-ordinate of the candy. Next M lines contain 4 space separated integer x1,y1,x2 and y2 - the co-ordinates of 3 vertex of triangle hence are (0,0),(x1,y1) and (x2,y2).


0 <= N,M <= 100000

All co-ordinate values fit in a 32 bit signed variable.

Warning : Large Input Data.

Output Format

For each test case, output M lines each containing a single character 'Y' or 'N'. If there is atleast one candy inside the corresponding triangle, output 'Y' ( without quotes ) else output 'N' (without quotes).

Sample Input 1

1
2 1
1 1
2 2
1 0 0 1

Sample Output 1

N

Hints

Problem Source

Migrated from old NTUJ.

CodeCraft 2010

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 16384