自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

写东西的地方

on the way

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

原创 hdu 4418 高斯消元+概率dp

Time travelTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2141    Accepted Submission(s): 489Problem DescriptionAgent K is

2015-09-21 17:20:07 729

原创 SPOJ COT2 树上的莫队算法,树上区间查询

题意:n个节点形成的一棵树。每个节点有一个值。m次查询,求出(u,v)路径上出现了多少个不同的数。树上的莫队算法,同样将树分成siz=sqrt(n)块,然后离线操作。先对树dfs一遍,每当子树节点个数num>=siz,就将这num个分成一块。读取所有的查询按左端点所在块排序。重点在于怎么进行区间转移,对路径的lca特殊处理,参考博客http://blog.csdn.net/kuribohg

2015-08-17 19:09:00 2133

原创 hdu 5381 莫队算法/gcd

The sum of gcdTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 645    Accepted Submission(s): 279Problem DescriptionYou have an array

2015-08-17 18:55:41 909

原创 主席树(可持久化线段树)入门专题

1.poj 2104 查询区间第k小。主席树其实相当于建立了n棵线段树,第i棵线段树是根据区间【1,i】按值建立的。对于每一棵线段树我们记录它对应的区间每个数出现的次数,所以首先要对所有的数离散化。先考虑最简单的情况,只查询【1,n】的第k小,对于【1,n】我们按值建立一棵线段树,对于a[i]我们在位置a[i]上加1。查询第k小那么先看左子区间出现了多少个数cnt,假设左区间出现的数cnt

2015-08-16 18:34:52 5964

原创 zoj 2112 Dynamic Rankings 带修改区间第k大的几种解法

给出n个数,有两种操作,一种是修改某个数的值,另一种查询指定区间第k大。比较快的做法是树套树,而分块算法复杂度比较高写起来方便。分块算法可以很简单的处理单独修改某个值的情况。将n个数分成num块,每块大小siz=n/num。每一块内部排序进行排序,查询[l,r]第k大时,先二分答案,对于完全包含在区间的内块直接二分搜索,而对于区间两端只有部分包含的则直接遍历查找。复杂度是logn*(2*s

2015-08-16 12:28:18 3657 2

原创 cf-546E 网络流,状态转移平衡

E. Soldier and Travelingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the country there are n cities a

2015-08-15 16:44:20 677

原创 hdu 3998 最长上升子序列个数+网络流 (最多不相交合法路径数)

SequenceTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1886    Accepted Submission(s): 687Problem DescriptionThere is a sequenc

2015-08-12 22:37:40 943

原创 hdu 3416 最短路+网络流(不重叠最短路径计数)

Marriage Match IVTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2594    Accepted Submission(s): 772Problem DescriptionDo not si

2015-08-12 22:11:57 805

原创 hdu 3338 网络流填数字

Kakuro ExtensionTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1268    Accepted Submission(s): 439Special JudgeProblem DescriptionI

2015-08-10 14:55:28 1464

原创 poj 1741 树分治入门

题意:统计距离这道题用的树的点分治方法。点分治基于树的重心。树的重心,定义是删除某个点后得到的最大(节点数)子树的节点数最小。性质是,可以证明删除掉重心后,每个子树的大小

2015-08-03 23:20:45 554

原创 hdu 5324 树套树、cdq分治

一、线段树/树状数组套平衡树题目大意是给你n个(L[i], R[i])的点,找出最长的子序列,满足L[i]递减,R[i]递增。为了看起来顺眼点,我们可以把其中一维取相反数,使得两个都找递减,或者都找递增的。我们把L[i]取相反数,找两个都递增的。假设不考虑R[i],只考虑L[i],那么就相当于LIS问题了。dp[i]记录以L[i]为结尾的最大长度,dp[i]=max{dp[

2015-08-02 11:33:53 630

原创 hdu 4630 线段树+离线处理

No Pain No GameTime Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1790    Accepted Submission(s): 763Problem DescriptionLife is a g

2015-07-29 11:46:02 577

原创 poj 3415 后缀数组+单调队列

Common SubstringsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 8106 Accepted: 2688DescriptionA substring of a string T is defined as:T(i, k)=TiT

2015-05-18 17:47:46 569

原创 poj 1325 最小顶点覆盖

Machine ScheduleTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12559 Accepted: 5368DescriptionAs we all know, machine scheduling is a very classical pr

2015-05-17 11:15:30 596

原创 poj 2446 二分图最大匹配 匈牙利算法

ChessboardTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 14525 Accepted: 4513DescriptionAlice and Bob often play games on chessboard. One day, Alice dr

2015-05-17 11:10:02 496

原创 poj 1422 最小路径覆盖

Air RaidTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7172 Accepted: 4261DescriptionConsider a town where all the streets are one-way and each street

2015-05-17 11:06:17 409

原创 poj 3352 双连通分量

Road ConstructionTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 9542 Accepted: 4739DescriptionIt's almost summer time, and that means that it's alm

2015-05-12 19:43:58 469

原创 hdu 4738 边双连通&桥,有重边情况

Caocao's BridgesTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1955    Accepted Submission(s): 699Problem DescriptionCaocao was def

2015-05-12 19:41:39 525

原创 zoj 3649 树上的倍增法

Social NetTime Limit: 5 Seconds      Memory Limit: 65536 KBThere are n individuals(2 n <= 30000). Everyone has one or more friends. And everyone can contact all people by friend-relation. If

2015-05-09 15:03:24 703

原创 hdu 2255 二分图最大权匹配 km算法模板

代码是打的kuangbin的模板#include #include #include using namespace std;const int maxn= 305;const int inf= 0x3f3f3f3f;int g[maxn][maxn];int nx,ny;//二分图两类点的个数int linker[maxn],lx[maxn],ly[maxn];i

2015-05-09 15:02:28 569

原创 poj 3580 区间翻转、插入、删除、循环位移

SuperMemoTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 11004 Accepted: 3461Case Time Limit: 2000MSDescriptionYour friend, Jackson is invited

2015-05-02 16:46:54 502

原创 hdu 1890 Splay区间最小值、区间翻转

Robotic SortTime Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2800    Accepted Submission(s): 1217Problem DescriptionSomewhere deep in

2015-05-02 11:47:12 523

原创 hdu 3308 线段树-区间连续最长上升子序列

LCISTime Limit: 6000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4842    Accepted Submission(s): 2166Problem DescriptionGiven n integers.You ha

2015-05-01 13:40:41 900

原创 poj 1816 Trie+DFS匹配模式串

Wild WordsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 4887 Accepted: 1274DescriptionA word is a string of lowercases. A word pattern is a string of

2015-04-26 12:06:21 460

原创 poj 2778 AC自动机+dp矩阵快速幂

DNA SequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12628 Accepted: 4818DescriptionIt's well known that DNA Sequence is a sequence only contains

2015-04-24 20:59:39 402

原创 hdu 2222 ac自动机模板题

Keywords SearchTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 40636    Accepted Submission(s): 12942Problem DescriptionIn the moder

2015-04-24 15:42:49 427

原创 poj 1236 强连通分量+缩点

Network of SchoolsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12273 Accepted: 4887DescriptionA number of schools are connected to a computer network

2015-04-23 22:52:10 371

原创 poj 2774 后缀数组模板

求两个字符串的最长公共子串。将两个字符串连接为一个新字符串,并计算后缀数组和高度数组lcp。然后检查后缀数组中所有相邻的后缀,其中后缀分别属于第一和第二个字符串的lcp的最大值就是答案。#include #include #include #include #include #include #include #include #include #includ

2015-04-21 23:52:14 433

原创 poj 3090 欧拉函数

Euler函数表达通式:euler(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…(1-1/pn),其中p1,p2……pn为x的所有素因数,x是不为0的整数。euler(1)=1(唯一和1互质的数就是1本身)。欧拉公式的延伸:一个数的所有质因子之和是euler(n)*n/2。参考http://blog.csdn.net/once_hnu/arti

2015-04-20 21:47:43 463

原创 hdu 3973 字符串hash+线段树动态维护

AC's StringTime Limit: 30000/10000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1091    Accepted Submission(s): 311Problem DescriptionYou are given

2015-04-15 23:57:27 616

原创 poj 1997 trie树

Word PuzzleTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 1113 Accepted: 494DescriptionWhat a game collection it would be without famous and well kno

2015-04-14 18:01:20 523

原创 poj 3109 扫描线+bit

Inner VerticesTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 1815 Accepted: 479Case Time Limit: 2000MSDescriptionThere is an infinite square gr

2015-04-12 10:22:49 608

原创 poj 2155 二维树状数组/区间更新单点查询

MatrixTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 20002 Accepted: 7481DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j]

2015-04-08 18:07:18 543

原创 hdu 4819 二维线段树,单点修改区间查询

MosaicTime Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 916    Accepted Submission(s): 402Problem DescriptionThe God of sheep d

2015-04-08 17:39:13 1154 1

原创 poj 2887 块状数组/线段树

Big StringTime Limit: 1000MS Memory Limit: 131072KTotal Submissions: 5952 Accepted: 1405DescriptionYou are given a string and supposed to do some string manipul

2015-04-03 23:36:33 1406

原创 hdu 4986 Arc of Dream 矩阵快速幂求递推式

Arc of DreamTime Limit: 2000/2000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 2534    Accepted Submission(s): 777Problem DescriptionAn Arc of Drea

2015-04-03 00:07:32 494

原创 hdu 3879 最小割模型

Base StationTime Limit: 5000/2000 MS (Java/Others)    Memory Limit: 65768/32768 K (Java/Others)Total Submission(s): 1965    Accepted Submission(s): 831Problem DescriptionA famous mobil

2015-03-23 22:19:16 463

原创 poj 3041 二分图

AsteroidsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16344 Accepted: 8906DescriptionBessie wants to navigate her spaceship through a dangerous ast

2015-03-19 22:10:09 419

原创 codforeces 527D 贪心

D. Clique Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe clique problem is one of the most wel

2015-03-19 16:09:25 572

原创 codeforces 515d 拓扑排序/二分图

D. Drazil and Tilestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDrazil created a following problem abou

2015-03-17 20:10:03 710

空空如也

空空如也

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

TA关注的人

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