HDU3487 play with chain】的更多相关文章

Play with Chain Problem Description YaoYao is fond of playing his chains. He has a chain containing n diamonds on it. Diamonds are numbered from 1 to n.At first, the diamonds on the chain is a sequence: 1, 2, 3, …, n.He will perform two types of oper…
题目传送门 题目描述 Problem Description YaoYao is fond of playing his chains. He has a chain containing n diamonds on it. Diamonds are numbered from 1 to n.At first, the diamonds on the chain is a sequence: 1, 2, 3, …, n.He will perform two types of operation…
HDU3487 splay最核心的功能是将平衡树中的节点旋转到他的某个祖先的位置,并且维持平衡树的性质不变. 两个操作(数组实现) cut l,r, c把[l,r]剪下来放到剩下序列中第c个后面的位置. flip l r 把[l,r]翻转(lazy标记,每次交换左右节点) cut思路:把l-1旋到根,r+1旋到根的右节点,取下这一段:在剩下的序列中找到c,c+1的位置,把c旋到根,c+1旋到右节点,插入. 由平衡树性质易证得是对的(中序遍历恒定) flip思路:把l-1旋到根,r+1旋到右节点,…
题目大意:给出1到n的有序数列,现在有两个操作: 1.CUT a b c 把第a到第b个数剪切下来,放到剩下的第c个数的后边. 2.FLIP a b  把第a到第b个数反转. 经过总共m次操作后,求现在的数列. n,m<300000 分析:典型的splay题.包含的操作即:查找第k大,剪切,插入,反转等操作. 维护size,rev(反转标记)即可. 通过size可以找到第k大,通过rev做懒标记,可以进行反转. 具体说就是,比如要剪切CUT a,b,c,以先把第a-1个节点splay到根的位置,…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3487 对于一个数列有两种操作:1.CUT a b c,先取出a-b区间的数,然后把它们放在取出后的第c个数后面.2.FLIP a b,把区间a-b的数反转.对于第一个操作,进行两次区间移动,第a-1个数Splay到根节点,b+1个数Splay到root的右儿子,ch[ch[root][1]][0]则表示那个区间,然后把它们除掉,然后在移动区间,把第c个数Splay到root,第c+1个数Splay到…
Problem Description YaoYao is fond of playing his chains. He has a chain containing n diamonds on it. Diamonds are numbered from 1 to n.At first, the diamonds on the chain is a sequence: 1, 2, 3, …, n.He will perform two types of operations:CUT a b c…
Play with Chain Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) [Problem Description] YaoYao is fond of playing his chains. He has a chain containing n diamonds on it. Diamonds are numbered from 1 to n. At first, t…
Play with Chain Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5426    Accepted Submission(s): 2185 Problem Description YaoYao is fond of playing his chains. He has a chain containing n diamon…
Play with Chain Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2783    Accepted Submission(s): 1141 Problem Description YaoYao is fond of playing his chains. He has a chain containing n diamond…
现象 CPU: STM32107VC 用JLINK 烧写程序时出现NO Cortex-m device found in JTAG chain 如图无法查找到硬件就是CPU 提示1:NO Cortex-M device found inJTAG chain.please check the JTAG cable and the connected devices     提示2:error:flash download failed-target DLL has been cancelled 原…