随笔分类 -  树——fhq treap

摘要:这道题放了很久还是回来补了 D 天才麻将少女KPM SRM 07 背景&&描述 天才麻将少女KPM立志要在日麻界闯出一番名堂。 KPM上周叒打了n场麻将,但她这次又没控分,而且因为是全市参与的麻将大赛,所以她的名次范围是0..10^5。 名次可能等于0是因为KPM那场没去打= = 没去打就意味着无限 阅读全文
posted @ 2017-07-29 08:46 友人Aqwq 阅读(383) 评论(1) 推荐(2)
摘要:fhqtreap的写法 操作其实都差不多哇 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int M=200050; int read(){ int ans=0,f=1,c=getc 阅读全文
posted @ 2017-06-03 14:36 友人Aqwq 阅读(333) 评论(0) 推荐(0)
摘要:这道题写法和之前差不多 但是fhqtreap在加点的时候为了同时维护大根堆以及二叉排序树的性质所以插入时也要注意分裂 fhqteap需要判断指针是否为空 不然就会re 这个我调了很久 #include<cstdio> #include<cstring> #include<algorithm> usi 阅读全文
posted @ 2017-06-02 21:13 友人Aqwq 阅读(295) 评论(0) 推荐(0)
摘要:fhqtreap的速度果然很快 花了时间学了下指针写法 没有旋转 只有分裂以及合并操作 其实还是蛮好写的 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int M=50055; in 阅读全文
posted @ 2017-06-02 14:27 友人Aqwq 阅读(257) 评论(0) 推荐(0)
摘要:#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]; 阅读全文
posted @ 2017-05-26 19:28 友人Aqwq 阅读(197) 评论(0) 推荐(0)