Count Offline
Easy
Execution time limit is 2 seconds
Runtime memory usage limit is 256 megabytes
You are given a set of points on a plane and need to handle two types of queries:
+ x y — Add the point (x, y) to the set.
? x_1 y_1 x_2 y_2 — Determine how many points lie within the rectangle defined by [x_1..x_2]×[y_1..y_2]. Points on the boundary and corners are included. It is guaranteed that x_1 ≤ x_2 and y_1 ≤ y_2.
Input
The input begins with the number of points N (1 ≤ N ≤ 50000). This is followed by N points. Next, the number of queries Q (1 ≤ Q ≤ 100000) is given, followed by Q queries. All coordinates are within the range from 0 to 10^9.
Output
For each GET query, output a single integer representing the number of points inside the specified rectangle.
Examples
Input #1
Answer #1
Submissions 389
Acceptance rate 10%