
主席树等各种树
algzjh
这个作者很懒,什么都没留下…
展开
-
主席树
示例题目: SPOJ DQUERY - D-query题目大意:给出一个序列,查询区间内有多少个不相同的数。 解题思路:主席树#include<iostream> #include<cstdio> #include<string> #include<cmath> #include<vector> #include<map> #include<set> #include<queue> #includ转载 2017-08-16 10:14:10 · 340 阅读 · 0 评论 -
POJ-2104(主席树)
示例题目: POJ2104 K-th Number题目大意:静态区间第kk大 解题思路:主席树#include<iostream> #include<cstdio> #include<string> #include<cmath> #include<vector> #include<map> #include<set> #include<queue> #include<algorithm> #in转载 2017-08-16 10:44:23 · 527 阅读 · 0 评论 -
ZOJ2112-Dynamic Rankings(树状数组套主席树)
Dynamic RankingsTime Limit: 10 Seconds Memory Limit: 32768 KBThe Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply find the k-转载 2017-08-16 15:22:20 · 397 阅读 · 0 评论 -
POJ2104-K-th Number
K-th NumberTime Limit: 20000MS Memory Limit: 65536K Total Submissions: 58596 Accepted: 20333 Case Time Limit: 2000MS DescriptionYou are working for Macrohard company in data structures de原创 2017-08-03 09:26:36 · 314 阅读 · 0 评论 -
SPOJ-COT-Count on a tree
COT-Count on a treeYou are given a tree with N nodes.The tree nodes are numbered from 1 to N.Each node has an integer weight.We will ask you to perform the following operation:u v k : ask for the kth m转载 2017-08-23 16:45:07 · 365 阅读 · 0 评论 -
主席树模板
参考题目:POJ2104 interval k-th#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<vector> using namespace std; const int MAXN=1e5+5; int n,m,cnt,root[MAXN],a[MAXN],x,y,k;stru转载 2017-10-22 10:13:42 · 309 阅读 · 0 评论 -
主席树区间修改模板
参考题目:hdu4348 To the moon#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int N = (int)3e6+10; const int M = (int)1e5+10; typedef long long ll; int ls转载 2017-10-22 10:16:03 · 695 阅读 · 0 评论 -
COJ1981-小M的魔术表演
小M的魔术表演Description 小M听说会变魔术的男生最能吸引女生注意啦~所以小M费了九牛二虎之力终于学会了一个魔术: 首先在桌面上放N张纸片,每张纸片上都写有一个数字。小M每次请女生给出一个数字x,然后划定任意一个区间[L,R],小M就能立马告诉对方这个区间内有多少个数字比x小。 小M当然是知道答案的啦,但是你呢?Input 第一行为一个数字T(T<=10)表示数据组数 第二行为两原创 2017-10-25 21:59:55 · 909 阅读 · 0 评论 -
Splay模板
#include #include #include #include #include using namespace std; typedef long long LL; const int INF=0x3f3f3f3f; const int MAXN=1e5+5; int a[MAXN]; //结点 struct Node{ int val,sz,rev,add;//结点值,大小,原创 2018-01-25 22:02:00 · 248 阅读 · 0 评论