随笔分类 - 树——fhq treap
摘要:这道题放了很久还是回来补了 D 天才麻将少女KPM SRM 07 背景&&描述 天才麻将少女KPM立志要在日麻界闯出一番名堂。 KPM上周叒打了n场麻将,但她这次又没控分,而且因为是全市参与的麻将大赛,所以她的名次范围是0..10^5。 名次可能等于0是因为KPM那场没去打= = 没去打就意味着无限
阅读全文
摘要:fhqtreap的写法 操作其实都差不多哇 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int M=200050; int read(){ int ans=0,f=1,c=getc
阅读全文
摘要:这道题写法和之前差不多 但是fhqtreap在加点的时候为了同时维护大根堆以及二叉排序树的性质所以插入时也要注意分裂 fhqteap需要判断指针是否为空 不然就会re 这个我调了很久 #include<cstdio> #include<cstring> #include<algorithm> usi
阅读全文
摘要:fhqtreap的速度果然很快 花了时间学了下指针写法 没有旋转 只有分裂以及合并操作 其实还是蛮好写的 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int M=50055; in
阅读全文
摘要:#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int M=100005; int n,m,root; int c[M][2],fa[M],size[M]; bool rev[M];
阅读全文