自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

MY Blog

我最讨厌中途放弃的人

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

原创 HDU 3308 LCIS 线段树维护区间lcs

题意:给一个1~n的数组操作i把下标为x的值更新为y操作ii查询区间 x~y的lcs具体分析写在代码里///参考讨论版ACcode:

2016-05-31 21:45:02 622

原创 POJ 3667 Hotel 线段树区间合并

题意一开始有1~n个空房间对应2个操作 i)问有没有连续的长度为x的x间房如果有占满最左边的那个区间,输出这个区间的起点ii)把区间x~x+y-1的房间清空一个很明显的区间合并具体注意点写在注释里了ACcode:#include #include #define tmp (st<<1)#define mid ((l+r)>>1)#define lson l,mi

2016-05-31 17:54:35 500

原创 HDU 1540 Tunnel Warfare xds

G - Tunnel WarfareTime Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 1540Appoint description: System Crawler  (2016-05-28)Descri

2016-05-31 12:28:51 472

原创 HDU 4027 Can you answer these queries? 线段树

题意:给你一个区间有两种操作 i)把x~y区间数据减小至原来的值的平方根 ii)查询区间x~y的值分析:简单的线段树更新,强烈剪枝  如果区间和sum【st】=r-l+1说明这个区间值全为一不需要继续操作 tle->acACcode:#include #include #include #include #define maxn 100002#define ll

2016-05-30 21:16:55 504

原创 HDU 1698 Just a Hook 线段树区间更新

题意:给你一个1到n的区间有q次操作每次操作把区间x~y替换成z最开始每个区间值为1  求最后整个区间的和 裸的区间替换ACcode:#include #include #include #define maxn 100011#define mid ((l+r)>>1)#define tmp (st<<1)#define len (r-l+1)#defin

2016-05-30 13:20:50 449

原创 hdu 5639 D Game 区间dp

D GameTime Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 298    Accepted Submission(s): 106Problem Description众所周知,度度熊喜欢的字符只有两个:B 和

2016-05-28 16:27:29 554

原创 bzoj 1509 逃学的小孩

1509: [NOI2003]逃学的小孩Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 646  Solved: 338[Submit][Status][Discuss]DescriptionInput第一行是两个整数N(3  N  200000)和M,分别表示居住点总数和街道总数。以下M行,每行给出一条街道的信息

2016-05-28 10:52:04 1131

原创 1588: [HNOI2002]营业额统计 splay 入门

splay tree 伸展树 推荐论文   伸展树的基本操作与应用 Description营业额统计 Tiger最近被公司升任为营业部经理,他上任后接受公司交给的第一项任务便是统计并分析公司成立以来的营业情况。 Tiger拿出了公司的账本,账本上记录了公司成立以来每天的营业额。分析营业情况是一项相当复杂的工作。由于节假日,大减价或者是其他情况的时候,营业额会出现一定的波动,当然一定的波

2016-05-27 12:43:25 467

原创 poj 1036 Gangsters lis

题意:N个强盗先后在时间Ti到达酒馆这N个强盗身上有Pi钱这N个强盗的体型为Si大小现在这个酒馆有一个伸缩门初始状态下大小为0,每个时刻大小可以加一或减一如果第i个强盗在到达酒馆的时候门的大小和他的体型一样,那么酒馆可以把强盗的钱挣到问如何操作使得酒馆挣到的钱最大分析:仔细想想就会发现,其实这就是一个有限制条件的lis每次判断下是否可以取到ACcode:#i

2016-05-25 20:49:43 523

原创 sdut 2169 Sequence 区间dp

SequenceTime Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述Given an integer number sequence A of length N (1<=N<=1000), we define f(i,j)=(A[i]+A[i+1]+...+A[j])^2 (i<=j).

2016-05-25 12:39:08 365

原创 sdut 2609 A-Number and B-Number

A-Number and B-NumberTime Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述    Tom is very interested in number problem. Nowadays he is thinking of a problem about A-number and B-numb

2016-05-24 19:13:46 468

原创 sdut 2884 Painting Cottages 计算几何

Painting CottagesTime Limit: 2000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述The new cottage settlement is organized near the capital of Flatland. The construction company that is

2016-05-24 14:25:55 464

原创 sdut 2880 Devour Magic 线段树 区间更新和区间替换

题意:给你一个1~n的区间,每过一个单位时间区间值加一现在有一个操作 t l r 表示在t时间把 l--->r的值累加为ans然后清零分析:就是成段更新和成段替换 替换的优先级高于成段替换ACcode:#include #include #define ll long longusing namespace std;#define maxn 100010#defi

2016-05-24 11:15:05 656

原创 sdut 2878 Circle 高斯消元

题意:在一个0~n的环上每次可以向左走或向右走求走到x的步数的期望分析:因为是环形的不好递推考虑到 dp【i】=dp【(i+1)%n】/2+dp【(i-1)%n】/2+1可以转化为 dp【i】-dp【(i+1)%n】/2-dp【(i-1)%n】/2=1所以可以列n个方程利用高斯消元来解貌似网上有别的做法表示看不懂orzACcode:#include #in

2016-05-23 20:41:52 767

原创 sdut 3256 BIGZHUGOD and His Friends II

BIGZHUGOD and His Friends IITime Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述BIGZHUGOD and his three friends are playing a game in a triangle ground.The number of BIG

2016-05-21 20:51:45 572

原创 sdut 3262 Circle of Friends tarjan

Circle of FriendsTime Limit: 2000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述Nowadays, "Circle of Friends" is a very popular social networking platform in WeChat. We can share our

2016-05-21 11:08:49 579

原创 sdut 3257 Cube number

Cube NumberTime Limit: 2000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述In mathematics, a cube number is an integer that is the cube of an integer. In other words, it is the produc

2016-05-20 20:00:04 711

原创 sdut 3258 Square Number 打表

Square NumberTime Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述In mathematics, a square number is an integer that is the square of an integer. In other words, it is the

2016-05-20 15:21:32 703

原创 sdut 3260 Single Round Math 模拟

Single Round MathTime Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述Association for Couples Math (ACM) is a non-profit organization which is engaged in helping single peo

2016-05-20 13:01:02 432

原创 sdut 3252 Lowest Unique Price set

Lowest Unique PriceTime Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述Recently my buddies and I came across an idea! We want to build a website to sell things in a new wa

2016-05-18 20:40:55 416

原创 sdut 3251 Nias and Tug-of-War 模拟

Nias and Tug-of-WarTime Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^题目描述Nias is fond of tug-of-war. One day, he organized a tug-of-war game and invited a group of friends t

2016-05-18 20:08:21 683

原创 sdut 3253 Game! 博弈

题意:一个1~n的环每个人每次可以拿一个石头或者拿连续2个的石头(即第i个和第i+1个)最后一个取完的就是赢家问先手是否能胜分析:当n为1和2的时候先手必胜,当n为3的时候为必败当n为4的时候无论怎么取都将进入必胜态即n为4先手必败,手推几个情况后断定n大于2的时候先手必败ACcode:#pragma warning(disable:4786)//使命名长度不受限制#pr

2016-05-18 16:56:59 467

原创 POJ 1113 wall 求凸包

题意求把给出的点围起来一面墙且距离最小为L分析根据下图可以知道其实就是求凸包加上一个半径为L的圆周长那么就是一个裸的凸包问题啦一般来说求凸包有两种做法,卷包裹法和 Graham-Scan看起来卷包裹更优秀呢(对于这题       卷包裹的原理比较简单:先找一个最边缘的点(一般是最左下角的),假设有一条绳子,以该点为端点向右边逆时针旋转直到碰到

2016-05-18 15:41:10 407

原创 ZOJ 3329 One Person Game 概率dp

题意:现在有3个骰子每个骰子各有k1,k2,k3个面(1游戏规则如下:开始的计分为0每次骰3个骰子 如果第一个骰子对应a且第二个骰子对应b且第三个骰子对应c分数清零否则加上这个3个骰子对应的数如果分数超过规定的分数n结束游戏否则继续游戏问骰的次数的期望分析:因为是求期望要倒着推嘛可以规定dp【i】为分数为i的期望那么当i>n的时候dp【i】的值必定为0啦对于dp

2016-05-17 21:20:16 293

原创 POJ 3744 Scout YYF I 矩阵快速幂+概率dp

题意:  yyf每次能走一步或二步概率为p和1-p路上有n个地雷  分布在di位置上问yyf能安全通过这条路的概率分析可以容易的得出 dp【i】=p*dp[i-1]+(1-p)*dp[i-2]因为路长是1e9推会爆炸考虑利用矩阵快速幂优化要安全跨过某个地累则一定是在地雷的前一步的地方一次性走两布然后把通过所有地雷的概率连乘就是答案ACcode:#pragma

2016-05-17 18:57:23 422

原创 POJ 2096 Collecting Bugs 概率dp

题意:有n种bug存在于s个系统中,每次可以找到一个bug问在s个系统中找到n种bug且每个系统最少找到一种的概率是多少分析:因为bug的数量是无限所以每次都有n*s种可能可设dp【i,j】表示当前已经在j种系统中发现i种bug了那么对于dp【i,j】有下面五种后继dp【i,j】 dp【i+1,j】 dp【i,j+1】dp【i+1,j+1】坑点是输出用 .4fACcod

2016-05-17 16:03:31 276

原创 51nod 求循环数组的最大子串和

分析:(1)笨方法,我们可以用普通最大子段和的方法解决这个问题。我们从每个位置“断开”环,然后按普通的最大子段和的方法去做。这样做的复杂度是O(n^2)。(2)巧妙点的方法,我们之所以要从某个位置切开是因为循环的最大子段和可能是跨越一部分头和尾。如上图,最优解可能是0..i, j + 1.. n – 1两段,那这时,其实中间i + 1..j是个“最小子段和”,因为总和是一定得嘛

2016-05-14 17:27:09 692

原创 poj 1050 To the Max && 51nod dp 最大子矩阵和

思路:我们把每一列第i行到第j行之间的和求出来,形成一个数组c,于是一个第i行到第j行之间的最大子矩阵和对应于这个和数组c的最大子段和。然后每次求数组c的最大子串和,ACcode:#include #include #include #include #include #include #include #include #define maxn 700#defi

2016-05-14 16:28:47 356

原创 51nod 1134 最长递增子序列 nlogn lis

记录下模板 #include #include #include #include #include #include #include #include #define maxn 70000using namespace std;int b[maxn],dp[maxn];int find_it(int x,int len){ int l,r,m; l=1

2016-05-14 11:49:00 806

原创 Codeforces Round #157 (Div. 1) B. Little Elephant and Elections 数位dp

题意:  规定一个数的幸运度为这位数含有多少4和7现在在值为1~m的m个数中任意选7个问第7个数的幸运度比前6个数幸运度总和还要多的情况有多少种m分析:因为幸运度最大为9所以可以先跑一发数位dp预处理出1~m中不同幸运度的个数然后再跑一发dfs枚举第七位的幸运度求符合条件的个数ACcode:#include #include #include #define

2016-05-14 10:42:01 451

原创 HDU 4336 Card Collector 概率dp 状态压缩

题意:给你n个卡片和这n个卡片获得的概率求解收集全部卡片的期望因为一共20个卡片可以利用状态压缩表示 0表示没收集 1表示 已经收集了ACcode:#include #include #include using namespace std;double dp[1<<21];double p[22];double DP(int n,double t){ dp

2016-05-13 20:49:02 306

原创 POJ 1696 Space Ant Graham-scan

H - Space AntTime Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 1696Appoint description: System Crawler  (2016-05-06)Descripti

2016-05-13 16:58:26 486

原创 POJ 1410 Intersection 计算几何 判断线段与矩形位置

G - IntersectionTime Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 1410Appoint description: System Crawler  (2016-05-06)Descript

2016-05-13 14:36:22 389

原创 POJ 1066 Treasure Hunt 计算几何

F - Treasure HuntTime Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 1066Appoint description: System Crawler  (2016-05-06)Descr

2016-05-13 13:28:59 268

原创 SPOJ BALNUM Balanced Numbers 数位dp

K - Balanced NumbersTime Limit:123MS     Memory Limit:1572864KB     64bit IO Format:%lld & %lluSubmit Status Practice SPOJ BALNUMAppoint description: System Crawler  (2016-05-05)

2016-05-13 10:59:21 465

原创 POJ 2104 K-th Number&&HDU 2665 Kth number划分树 求区间第k大 裸题

K-th NumberTime Limit: 20000MS Memory Limit: 65536KTotal Submissions: 46800 Accepted: 15641Case Time Limit: 2000MSDescriptionYou are working for Macrohard c

2016-05-12 14:39:22 557

原创 CodeForces 55D Beautiful numbers 数位dp 离散化

A - Beautiful numbersTime Limit:4000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64uSubmit Status Practice CodeForces 55DAppoint description: System Crawler  (2016-05-08)

2016-05-11 23:22:39 478

原创 POJ 2556 Edge 线段的旋转

E - EdgeTime Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 2556Appoint description: System Crawler  (2016-05-10)Description

2016-05-11 21:20:47 514

原创 HDU 2072 单词数 字典树

G - 单词数Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionlily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这

2016-05-11 18:46:50 537

原创 POJ 1269 Intersecting Lines 直线相交判断

D - Intersecting LinesTime Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 1269Appoint description: System Crawler  (2016-05-08)

2016-05-10 21:50:17 830

空空如也

空空如也

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

TA关注的人

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