Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 303 Weeks Ago, 4 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 17 Sep 2017 My Price 6.00

2D Coordinate System.

You are given N lattice points (Xi, Yi), i = 1, 2, ..., N on a 2D Coordinate System.
You have to process Q queries, each query will be given as the form "x y d".
Let ABC be the triangle having vertices at A(x+d, y), B(x, y) and C(x, y+d).
For each query, you have to find how many of the given lattice points lie inside or on the boundary of the triangle ABC.

Input

The first line of the input contains two space-sparated integers N and Q.
Each of the following N lines have two space-sparated integers Xi, Yi giving the x and y coordinate of a lattice point.
Then the following Q lines contain three space-sparated integers x, y, d giving a query.

Output

For each query, output one integer on a line which denotes the number of the given lattice points which lie inside or on the boundary of the triangle.

Constraints

1 = N = 300000 (3 * 105)
1 = Q = 200000 (2 * 105)
1 = Xi, Yi = 300000 (3 * 105)
1 = x, y, d = 300000 (3 * 105)

Sample

Input 1: 5 3 1 3 1 5 3 6 4 4 2 6 1 5 3 1 5 4 1 1 1 Output 1: 3 3 0 Input 2: 2 2 1 5 3 7 2 5 6 2 3 4 Output 2: 1 0

Answers

(5)
Status NEW Posted 17 Sep 2017 05:09 AM My Price 6.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)