主席树
文章平均质量分 75
basasuya
这个作者很懒,什么都没留下…
展开
-
hdu5820 Lights
主席树 但是能够想到题解的做法很难 #include #include #include #include using namespace std; const int MAXN = 500010; int n; vector p[50010]; int T[50010]; struct Node{ int s; int ls, rs; }tree[MAXN * 16]; int原创 2016-08-29 11:49:41 · 462 阅读 · 0 评论 -
SPOJ D-QUERY
以前主席树学 kungbin 最近看了网上的版本 终于发现和我以前学的线段树差不多的了 希望最近能够加强 #include using namespace std; const int INF = 0x3f3f3f3f; const int MOD = 1e9+7; const int MAXN = 30005; struct Node{ int ls,rs, sum; }tree[MAX原创 2016-08-23 16:57:49 · 233 阅读 · 0 评论 -
POJ 2104 K-th Number 主席树
#include #include #include #include using namespace std; const int MAXN = 1e5+5; int N,M; int A[MAXN]; int has[MAXN]; int htot; int get(int x){ int tt = lower_bound(has,has+htot,x)-has; return tt+原创 2016-08-24 00:02:06 · 206 阅读 · 0 评论 -
CF368 E - Garlands
主席树 其实暴力二维树状还更快 #include using namespace std; typedef long long ll; const int MAXN = 2005; int N,M,K,Q; struct Node{ int x,y,w; Node(int a=0, int b=0, int c=0):x(a),y(b),w(c){} bool operator < (N原创 2016-08-25 00:24:33 · 520 阅读 · 0 评论 -
bzoj 4026 dC Loves Number Theory
把我写吐了 太弱了 首先按照欧拉函数性质 我只需要统计区间不同质数个数就好了 一眼主席树 其次我被卡了分解质因数这里 可以通过质数筛时就建边解决 不够灵性啊,不知道如何改#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6+1000; const int H = 5e4+5;原创 2016-10-10 18:26:39 · 660 阅读 · 0 评论 -
hdu5788 level up
贴下以前写的代码 比赛前我准备着重看的 主席树 树dp 字符串#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1e5+5; const int MOD = 1e9+7;int N; int A[MAXN]; vector<int> mp[MAXN]; int val[MAXN]原创 2016-10-04 01:30:59 · 473 阅读 · 0 评论