自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

同学,你听说过DQS吗?

  • 博客(26)
  • 收藏
  • 关注

原创 bzoj 3155 Preprefix sum 树状数组

非常神奇的题目啊,我语文不好,所以不写题解了。#include<iostream> #include<cstdio> #define LL long long using namespace std; int n,m; LL a[100005]; LL c[100005]; void change1(int x,LL d) { while(x<=n) { c[x]+=

2016-09-29 11:14:10 432

原创 bzoj 3098 Hash Killer II 生日悖论

#include<cstdio> #include<iostream> #include<algorithm> using namespace std; int Rand() { int r=rand()<<16; r=r|rand(); } int main() { srand(790); int n=100000; int l= Rand()%n+1;

2016-09-29 10:07:43 691

原创 bzoj 3039 玉蟾宫 单调栈

。#include<iostream> #include<cstdio> #include<stack> using namespace std; int mp[1005][1005]; char c[2]; int h[1005][1005]; stack<int> S; int main() { // freopen("jademoon.in","r",stdin); // freopen(

2016-09-29 10:04:53 762

原创 bzoj 3223 文艺平衡树 Splay

Splay维护区间翻转裸题,但还是调了很长时间。#include<iostream> #include<cstdio> #define maxn 100005 using namespace std; int rev[maxn],fa[maxn],ch[maxn][2]; int sz[maxn]; int root; bool dir(int x) {return x==ch[fa[x]][1];

2016-09-29 10:00:32 383

原创 bzoj 2002 弹飞绵羊 LCT

先吐槽一句,这题分块比LCT快是什么鬼,LCT常数是有多大。LCT1.8s,分块总耗时1.6s。 主要思路:link(i,i+a[i]);弹出去的都连向节点n+1; 每次修改cut,link。查询是 以n+1为根,access(x),splay(x),x的子树大小,就是x点向后弹的节点数。#include<iostream> #include<cstdio> #include<algorithm

2016-09-28 19:04:35 429

原创 2015noipT3 斗地主 暴力模拟

#include<iostream> #include<cstdio> #include<queue> #include<algorithm> using namespace std; int a[20]; struct joker{ int p[20]; int ans; void print() { for(int i=0;i<=14;i++)

2016-09-28 17:04:04 903

原创 bzoj 1180 [CROATIAN2009]OTOCI - LCT

20分钟码完,手速++; 不过这道题正解是LCT吗,感觉很奇怪啊。#include<iostream> #include<cstdio> #define maxn 30005 using namespace std; int fa[maxn],ch[maxn][2],rev[maxn]; int sum[maxn],v[maxn]; bool dir(int x) {return x==ch[fa

2016-09-28 11:29:24 366

原创 LCT学习笔记

动态树问题: 动态加边,删边,始终保持是一棵或多棵树。 支持换根,修改点、边、路径权值(等信息),查询路径权值等。思想:把树分成若干个部分维护。和树链剖分相似,树链剖分的一些题目也可以用LCT来做。LCT的均摊复杂度是log²n,杨哲的论文(百度搜一下,%大神)有证明,但我太弱,看不懂,也不想研究……一些定义: access(x) :访问x,这个操作是LCT关键; Preferred ch

2016-09-28 10:41:48 682 2

原创 bzoj 2631 tree LCT+标记处理

这个题目名字好大众啊。 从昨天下午开始码,刚调出来。 由于LCT常数很大,一定要丧心病狂的优化常数,非常管用。#include<iostream> #include<cstdio> #define LL unsigned int #define P 51061 #define maxn 200005 using namespace std; int n,q; int fa[maxn],ch[ma

2016-09-28 08:15:00 428

原创 bzoj 3282 Tree 动态树LCT

学了一天LCT,还是不太明白,打(抄)了一个模板,先存着。#include<iostream> #include<cstdio> #include<algorithm> #include<stack> #define maxn 300005 using namespace std; inline void read(int &a) { a=0;char c=getchar(); wh

2016-09-27 15:30:30 481

原创 bzoj 3196 二逼平衡树 树套树

都是泪,调了一晚。代码能力++。 查询区间排名k,时间复杂度nlog³n,bzoj能A,但是tyvj TLE 两个点,求各路大神指错打脸。 另外推荐一个OJ cojs.tk 给数据,很良心。#include<iostream> #include<cstdio> #include<algorithm> #include<stack> #define maxn 1000005 //#

2016-09-26 21:45:41 438

原创 bzoj 1208 宠物收养所 Splay

我当时脑子一抽,用map查一个数值的编号,多一个log,貌似不影响AC。#include<iostream> #include<cstdio> #include<map> using namespace std; map<int,int> bh; int fa[80005],ch[80005][2]; int sz[80005],key[80005]; int t1,t2; int inf=2147

2016-09-26 17:22:17 504

原创 bzoj 1067 降雨量 线段树

用线段树维护区间最大,用map搞一搞判断,和离散化差不多,我语文不好。#include<iostream> #include<cstdio> #include<map> #include<algorithm> using namespace std; map<int,int> mp; int ni[50005]; struct xds { int l,r,sum; int num,m

2016-09-26 17:18:47 385

原创 bzoj 1066 蜥蜴 最大流

套路拆点,把石柱高度作为出点入点之间流量,最大流。#include<cstdio> #include<iostream> #include<queue> #include<algorithm> using namespace std; struct bian{ int to,cap,nxt; }b[64005]; int fst[1005],tot=1; int cur[1005]; voi

2016-09-26 17:14:06 392

原创 bzoj 1012 最大数 线段树 || 分块

线段树提前开20w个点建树就可以直接修改。#include<iostream> #include<cstdio> #define LL long long using namespace std; struct xds { int l,r; LL ma; }tree[800005]; void build(int dq,int l,int r) { tree[dq].l=l;

2016-09-26 17:10:34 352

原创 bzoj 1008 越狱 快速幂

#include<iostream> #include<cstdio> #define LL long long using namespace std; LL k; LL ksm(LL x,LL y) { if(y==0) return 1; if(y==1) return x; LL a=ksm(x,y/2)%k; if(y%2)

2016-09-26 17:07:33 412

原创 bzoj 1003 物流运输 DP+Spfa

一看到题目,吓了一跳,看到数据范围…… spfa(j,i)表示第j天到第i天可用点的最短路。 spfa(i,j) if(j!=0)dp[i]=min(dp[i],dp[j]+(i-j)*dis[m]+k); else dp[i]=min(dp[i],dp[j]+(i-j)*dis[m]);#include<cstdio> #include<iostrea

2016-09-26 17:05:17 575

原创 bzoj 2733 永无乡 Splay 启发式合并

题目大意:n(n<=10w)个点,每个点都有重要度,q(q<=30w)个操作。1.每次连接2个点。2.查询a,k;与a相连的第k重要是哪一个点,不存在输出-1。 查询可以Splay搞,修改暴力启发式合并,因为每次合并size翻倍,所以每个点最多被合并logn次。复杂度nlog²n。#include<cstdio> #include<iostream> #include<cstdlib> #defi

2016-09-24 15:17:05 759 1

原创 bzoj 2002 弹飞绵羊 分块(水)

这道题正解是LCT吗,不理解,用分块水的。#include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> using namespace std; int a[200005]; int b[200005]; int c[200005]; int inf=214748; int ask(int x) { int ans

2016-09-22 21:50:24 584

原创 bzoj 2330 糖果 差分约束

#include<iostream> #include<cstdio> #include<queue> using namespace std; struct bian { int to,d; }b[1120005]; int fst[120005],nxt[1120005],tot=1; long long dis[120005],inf=214748364; void build(int

2016-09-22 21:45:32 327

原创 bzoj1911 特别行动队 斜率优化

斜率优化最裸的裸题,但是式子推了好久,忘了形式。#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define LL long long using namespace std; LL dp[1000005]; LL s[1000005]; LL a,b,c; LL p(LL x) { retur

2016-09-21 21:16:19 371

原创 bzoj 1007 水平可见直线 贪心+初中数学

在xoy直角坐标平面上有n条直线L1,L2,…Ln,若在y值为正无穷大处往下看,能见到Li的某个子线段,则称Li为 可见的,否则Li为被覆盖的. 例如,对于直线: L1:y=x; L2:y=-x; L3:y=0 则L1和L2是可见的,L3是被覆盖的. 给出n条直线,表示成y=Ax+B的形式(|A|,|B|<=500000),且n条直线两两不重合.求出所有可见的直线. 对

2016-09-13 19:18:11 471

原创 bzoj4034 HAOI2015 T2 树链剖分

有一棵点数为 N 的树,以点 1 为根,且树点有边权。然后有 M 个 操作,分为三种: 操作 1 :把某个节点 x 的点权增加 a 。 操作 2 :把某个节点 x 为根的子树中所有点的点权都增加 a 。 操作 3 :询问某个节点 x 到根的路径中所有点的点权和。 这道题不会正解,树链剖分水过。 因为我太弱,LL和int ;%lld和%I64d没分清,调了一晚。#includ

2016-09-05 19:00:45 356

原创 CF #368 D Persistent Bookcase 操作树~?

Recently in school Alina has learned what are the persistent data structures: they are data structures that always preserves the previous version of itself and access to it when it is modified. Afte

2016-09-04 20:32:16 440

原创 bzoj 4518 征途 斜率优化

我想写题解,可我语文不好。#include<cstdio> #include<cstring> #include<iostream> using namespace std; int sum[3002],f[3002][3002]; int n,m,head,tail,a; int q[3002]; double get(int i,int x,int y) { return ((doubl

2016-09-02 21:17:36 305

原创 poj3281 Dining 最大流

模板#include<iostream> #include<cstdlib> #include<queue> #include<cstdio> #include<cstring> using namespace std; queue<int> q; struct Edge { int to,cap; }b[20005]; int fst[505],nxt[20005],tot=1; int

2016-09-02 21:03:24 339

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除