*BZOJ3165: [Heoi2013]Segment

$n \leq 100000$ points, in the coordinate system of $0 \leq x \leq 39989$, $0 \leq y \leq 1e9$, perform the following operations online: add a line segment; query the line $x=k$ Who is the top line segment.

Look at the range and know that it is a line segment tree (fog)

The interval records the uppermost line segment at the midpoint of the interval, so that when inquiring, take the max of the line segment tree to the highest point along the way to that point. When adding a line segment, the line segment will be positioned into $log$ intervals by the interval. Each time it is modified, if there is no intersection with the line segment of the current interval, the information of this interval will be directly changed to this line segment; otherwise, the middle point of the interval record is close to Then use another line segment to recurse to the corresponding interval to update the subinterval. Modify two logs and ask for one log.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324817976&siteId=291194637