The "BZOJ1095" "ZJOI2007" Hide hide-and-seek segment tree maintains the compression of the parentheses sequence data structure.

Source: Internet
Author: User

Link:
#include <stdio.h>int main(){    puts("转载请注明出处[vmurder]谢谢");    puts("网址:blog.csdn.net/vmurder/article/details/44829703");}
Exercises

First of all because the problem is so divine that I actually do not have this problem, so I might as well introduce the parentheses sequence to maintain the tree structure.

is actually false, is a point is swept into the stack, the sequence with an opening parenthesis, and then add a character (can not add), point out the stack with a closing parenthesis.

And then the distance between two points is two points in the middle of the sequence of brackets, delete some matching parentheses after the answer, such as ( ( ) ( , and in the end it becomes )(( , indicating that the left endpoint needs to go up one step, and the right endpoint needs to go up two steps.

Then how does this problem maintain the information in a sequence of parentheses?
......
First we have the code for [Hzwer Ben]:
Http://hzwer.com/5247.html
Secondly we have [    Island Niang    ] Comment:
http://www.shuizilong.com/house/archives/bzoj-1095-zjoi2007hide-%E6%8D%89%E8%BF%B7%E8%97%8F/
Finally, we also have the transfer formula [Cao Chin Xiang]
http://wenku.baidu.com/link?url=o6-p5-t1gye2v4huhozpldk__qud-jlxykjpv4hz– U2kczvfhl-vmmtmrgqpd3ze8gq2q7qc6heyw4x4beq33zoi3d6g_f53krcymdrfvo

Of course, we have [WJBZBMR] 's solution to the chain-splitting approach:
Http://hi.baidu.com/wjbzbmr/item/14ea8b7cb06bea36714423d0

......
In addition to this formula, please understand the code.
Because some variable names are already mixed up.

Code:

(Grilled hzwer, grilled very ugly, so do not post Qwq)

The "BZOJ1095" "ZJOI2007" Hide hide-and-seek segment tree maintains the compression of the parentheses sequence data structure.

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.