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.