Time Division and overall two-part summary

Source: Internet
Author: User

Time Division (also known as CDQ) is an algorithm to solve a kind of "contribution independent", "Support offline" data structure problem.

Suppose there is a sequence of operations: Abaabaabbaaab, where each a contributes a certain amount to the B behind it, which requires the output of each B corresponding answer.

"Contribution independence" means: the effect of each A on its subsequent B is not affected by other A, that is, we use all a in front of B to update B, then B's answer is correct.

Examples of contribution independence: Max,min,sum,count (extremum, and the number of a that satisfies a certain condition).

"Support offline" means that each AB must be given at the beginning, some problems (such as maintenance of convex hull optimized DP), maybe A and B are together, that is, affected by the previous things, the answer after the impact of the next thing, this thing can also be done (although at first it did not tell us what the impact of each of the back).

so that we can turn the above problem into: AAAABBBB, so that we can pre-process some information according to all of the previous a, and then go to update the following B (main).

Overall two points: to solve some questions have a dichotomy of the problem, but if a single query to go to two points, then for a query may need to do a preprocessing, time is not allowed.

The whole dichotomy is to share some preprocessing, and then at the same time the two points of all inquiries, the difficulty lies in sharing what information and how to achieve.

Time Division and overall two-part summary

Related Article

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.