1861: [Zjoi2006]Book 书架 - #include <Seter> - using namespace Orz;

1861: [Zjoi2006]Book 书架

Seter posted @ 2011年11月18日 20:55 in BZOJ with tags ZJOI BalancedTree Splay , 2800 阅读

 

http://www.zybbs.org/JudgeOnline/problem.php?id=1861

RunID User Problem Result Memory Time Language Code Length Submit Time
174521 Seter 1861 Accepted 4588 kb 624 ms C/Edit 2408 B 2011-11-18 20:37:53

 

一开始写这道题的时候总觉得自己的Splay模板的Join和Remove操作有问题……然后弄了半天各种WA囧,最后发现是题中的Insert操作交换时没更新指针……不过原来的Splay模板还真的有问题……Remove后可能存在未update的节点……改好就A了……

Query:Rank第i个节点后输出此节点的编号

Ask:Splay编号i对应节点后输出根的左子树的大小

Top/Bottom:删除编号i对应节点,找到最左/右边的节点,将编号i对应节点插入。(我的Splay在n=1时会出错,所以我特判了下)

Insert:0就不变,否则找到编号i对应节点的前/后继,与编号i对应节点交换,注意交换后的指针更新!

PS:Remove神马操作之后全部splay或者update一下……避免节点未update……

由于我感嚼我的Splay模板还有问题……所以就不挂Splay模板了囧……

 

By Seter
Alyssa 说:
2022年12月18日 21:03

Accidentally I have come across this website and little bit confused about the details shared here. The details center for rheumatology you have shared here are not familiar to me. I am looking here to more updates regarding that and hope that more details will be explained here soon. Keep sharing more updates here.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee