report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Triangle - MarisaOJ: Marisa Online Judge

Triangle

Time limit: 1000 ms
Memory limit: 256 MB
Given $n$ points on a two-dimensional coordinate system. There are $q$ queries of the form $(x, y, d)$. Count the number of vertices lying inside or on the edges of the triangle defined by three points $(x, y)$, $(x + d, y)$, and $(x, y + d)$. ### Input - The first line contains two integers $n$ and $q$. - The next $n$ lines each contain two integers $x$ and $y$, representing a point at coordinates $(x, y)$. - The next $q$ lines each contain three integers $x$, $y$, and $d$, representing a query. ### Output - Print $q$ integers. The $i$-th integer represents the answer to the $i$-th query. ### Constraints - $1 \leq n, q, x, y, d \leq 10^5$. ### Example Input: ``` 2 2 3 3 3 4 1 1 3 2 2 3 ``` Output: ``` 0 2 ```
Sweep Line
Intersections
Radio
Area
Square
Closest pair
Triangle
Paper cutting
Topic
Data structure
Rating 2100
Solution (0) Solution