Rectangular Queries#2959

Rectangular Queries

4 ثوان
256 ميغابايت
سهل

Given points on a plane, each with a specific value, you are required to efficiently process two types of queries:

المدخلات

The number of points (1 \leq N \leq 262144), followed by points. Each point is given as three numbers: , , and the initial value.

The number of queries (1 \leq M \leq 10^4), followed by queries. Queries are provided in the format =\ x_1\ y_1\ x_2\ y_2\ \text{value} for assignment and ?\ x_1\ y_1\ x_2\ y_2 for the minimum search.

All coordinates are in the range -10^9 to 10^9. All values are between and 10^9.

المخرجات

For each query, output the minimum value among the points inside the specified rectangle. If there are no points in the rectangle, output NO.

أمثلة

مثال 1

Loading
Loading