Hdu4866 shooting (resumable line segment tree)

Source: Internet
Author: User

Question:

We will give you some line segments parallel to the X axis. Each time you ask about the height and of the first K line segments above the X coordinate. The question must be online.

Ideas:

First, we need to persist the line segment tree (also known as the Chairman tree and functional Line Segment tree). We can't do anything about poj 2104.

Discretize the height of all line segments and create a line segment tree as a node. Create two Chairman trees. One is to insert the height of the Left endpoint of a line segment into the chair tree, and the other is to insert the height of the right endpoint of the line segment into the chair tree, then, when we ask about the coordinates x, what we actually want to ask is the first chair tree minus the first K height and, if you don't understand it, you can draw what each tree represents on the paper and then you will understand it.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.