
Treap
北屿小智障
喜欢有阳光的早晨
好像什么都可以重新再来。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
POJ_P1442 Black Box(Treap模板题+动态第k小)
传送门 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9588 Accepted: 3921 Description Our Black Box represents a primitive database. It can save an integer array and has a special原创 2016-02-02 15:45:38 · 664 阅读 · 0 评论 -
Codevs_P3299 有序数组合并求第K大问题(Treap)
传送门 九章算法面试题 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题目描述 Description 给出两个有序数组A和B(从小到大有序),合并两个有序数组后新数组c也有序,询问c数组中第k大的数假设不计入输入输出复杂度,你能否给出一个O(logN)的方法?输入描述 Input Description 第一行输入三个整数n、m和k第二行输入n个用原创 2016-02-02 15:52:54 · 414 阅读 · 0 评论 -
模板_Splay Tree
#include<cstdio>#include<cstdlib>#include<iostream>using namespace std;struct Node{ Node* ch[2]; int r,v,s; Node(int v):v(v){ch[0]=ch[1]=NULL;r=rand();s=1;} bool operator < (const N原创 2016-02-02 17:06:21 · 294 阅读 · 0 评论 -
模板_Treap
传送门#include<cstdio>#include<cstdlib>#include<iostream>using namespace std;struct Node{ Node *ch[2];//左右子树 int r,v,s; //随机优先值,值,节点总数 Node(int v):v(v){ch[0]=ch[1]=NULL;r=rand();s=1;}原创 2016-02-02 15:13:19 · 385 阅读 · 0 评论 -
BZOJ_P2733/Codevs_P1477 [HNOI2012]永无乡(Treap+启发式合并+并查集)
BZOJ传送门 Codevs传送门Time Limit: 10 Sec Memory Limit: 128 MB Submit: 2033 Solved: 1065 [Submit][Status][Discuss] Description 永无乡包含 n 座岛,编号从 1 到 n,每座岛都有自己的独一无二的重要度,按照重要度可 以将这 n 座岛排名,名次用 1 到 n 来表示。某些岛原创 2016-03-22 11:01:19 · 924 阅读 · 0 评论