- 博客(92)
- 收藏
- 关注
原创 【并查集】bzoj 1854
1854: [Scoi2010]游戏 Time Limit: 5 Sec Memory Limit: 162 MB Submit: 3683 Solved: 1398 [Submit][Status][Discuss] Description lxhgww最近迷上了一款游戏,在游戏里,他拥有很多的装备,每种装备都有2个属性,这些属性的值用[1,10000]之间的数表示。当他使用某
2016-05-05 20:39:03 224
原创 【状压+dp】zoj3812
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3812 题目大意:给出n个物品,每个物品有两种属性Wi,Ti,有q组查询,每组查询要求在n个物品中选出一些,并使得两个属性的和为Mi,Si。 思路:二维费用的背包,但是太大了会TLE或者mle…… 我们来观察一下状态 dp[i][j][k]表示使用前i个物品,
2015-02-20 21:36:59 323
原创 【数学】 CF 507C
题目链接:http://codeforces.com/problemset/problem/507/C 题目大意: 高度为h的满二叉树,从根节点出发,按照"LRLRLRLR...."的方式往下走,走到第n个叶子结点结束。如果走到了非n的叶子结点,那么就跳过下一个指令,回溯然后按照指令继续走没有走过的结点。问到达第n个叶子结点之前,有多少个结点被走过。 思路: 先设置一个初始方向。 高
2015-02-19 21:09:56 396
原创 【dp】cf 513G2
题目链接:http://codeforces.com/problemset/problem/513/G2 题目大意:给定有n个数的一个数列,每次操作是等概率翻转一个区间,这样操作k次,求逆序数对个数的期望。 (1 ≤ n ≤ 30, 1 ≤ k ≤ 200) 思路: f[k][i][j] 表示k次翻转以后a[i] 在a[j] 前面的概率,初始化条件是 f[0][i][j] = 1 f[0]
2015-02-19 16:18:16 384
原创 【dp】hdu5000
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5000 题目大意:有n种属性,每种属性的数值可以是0-T[i],当一个人属性全部小于等于另一个人的属性时,小的那个人会被淘汰,问最多同时存在多少人 思路: 如果我们设sum为一个人的属性和,显而易见的, 人数最多的情况下这些人的sum是相同的,因为一个属性减少另一个属性一定需要增加,然后我们可以知道
2015-02-16 21:18:49 316
原创 【dp】hdu5001
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5001 题目大意:一个人随即从一个点出发,到达邻接点的概率相同,求出走d步都不会到达1~n点的每一项的概率(这里第一次随即取的点是要求的点也算到达过了) 记得去年网的时候最开始直接算到某一个点的概念然后减掉,然后发现样例过不了,才意识到这样会把多次到达的概率重复计算… f[i][j] 仍然表示i步
2015-02-16 21:02:21 269
原创 【dp+二分】HDU 1025
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1025 题目大意:现在有两条平行线,给出两条线上的点的若干个匹配关系,求最多有多少对使得匹配连线不相交 思路:非常明显,这个题可以转化成按照一个量排序,求另一个量的最长上升子序列,但是这个题的范围很大,N^2要TLE……所以得用n上升子序列logn的办法求最长 代码:#inclu
2015-02-14 11:51:47 277
原创 【BFS+priority_queue】hdu 4198
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4198 题目大意: 给你一张地图,”S“为起点,"#"不能走,走过一个"."需要1个单位时间, 走过一个”@“需要d+1的单位时间,求中起点走出地图的最短时间…… 思路:我的第一反应是拆点……把一个“@”拆成d+1个,然后BFS但是这么写真的好麻烦啊! 可以用优先队列+BFS,先扩展路径长度比较短
2015-02-13 14:56:20 319
原创 【dp】ZOJ 3469
题目大意:有一个人他外卖员要去送外卖,他的店在X位置,他的速度为V,然后现在有N个人要外卖,坐标分别为Xi, 这N个人每等一分钟不满意度增加Bi,他送完所有人要让总的不满意度最少求最少的不满意度是多少……(语死早,总是描述不清楚题目在说什么) 看起来就像个区间dp,但是……于是就去看题解了,果然功力还很弱…… 首先我们可以知道,他肯定是从店铺所在位置向两边送(至于每次每边送多远就是需要dp算的了) f[i][j][0]表示送完[i,j]这个区间且送货员停在i位置,的最小不满值 f[i][j][1]表示送完[
2014-12-02 12:56:19 397
原创 【神奇的矩阵乘法】fzu2173
Nostop Description M国有N个城市,H条单向的道路,AekdyCoin从编号为1的城市出发,每经过一条道路要花一个单位的时间。假设他出发的时刻为0,他需要在K时刻到达编号为N的城市。并且,AekdyCoin不会在一个城市停留,每到一个城市他要立刻往下一个城市出发,最后在K时刻时他必须在城市N。虽然AekdyCoin经过任意一条道路的花费的时间都是1
2014-08-22 15:21:30 448
原创 【dp】hdu4901
The Romantic Hero Problem Description There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wis
2014-08-22 14:34:16 306
原创 【map + 线段树】 hdu4893
Wow! Such Sequence! Problem Description Recently, Doge got a funny birthday present from his new friend, Protein Tiger from St. Beeze College. No, not cactuses. It's a mysterious blackbox.
2014-08-22 14:11:15 411
原创 【反素数+线段树求约瑟夫环】poj2886
Who Gets the Most Candies? Description N children are sitting in a circle to play a game. The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero i
2014-08-19 11:51:17 455
原创 【线段树】zoj1484
Minimum Inversion Number Time Limit: 2 Seconds Memory Limit: 65536 KB The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj.
2014-08-19 11:30:47 298
原创 【线段树】poj2828
Buy Tickets Time Limit: 4000MS Memory Limit: 65536K Total Submissions: 13383 Accepted: 6659 Description Railway tickets were difficult to buy around the Lunar New Y
2014-08-19 11:23:59 301
原创 【并查集】POJ 1182
食物链 Description 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。
2014-08-19 11:13:56 275
原创 【线段树】hdu1828 & poj1177
补题解开始…… timu A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Each rectangle can be partially o
2014-08-19 10:13:05 312
原创 【数位dp】hdu4352
XHXJ's LIS Problem Description #define xhxj (Xin Hang senior sister(学姐)) If you do not know xhxj, then carefully reading the entire description is very important. As the strongest fighting force
2014-07-20 12:19:45 439
原创 【数位dp】hdu3709
Balanced Numbe Problem Description A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight ind
2014-07-20 12:07:59 360
原创 【线段树】hdu2795
Billboard Problem Description At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible ann
2014-07-18 14:17:55 298
原创 【线段树】poj2777
Count Color Description Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem. There is a very long bo
2014-07-17 20:55:30 303
原创 【线段树】hdu1166
敌兵布阵 Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的
2014-07-17 20:47:09 365
原创 【数位dp】hdu4389
X mod f(x) Problem Description Here is a function f(x): int f ( int x ) { if ( x == 0 ) return 0; return f ( x / 10 ) + x % 10; } Now, you want to know, in a given inter
2014-07-14 21:00:03 341
原创 【数位dp】cf55D
D. Beautiful numbers Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero dig
2014-07-12 22:02:11 516
原创 【数位dp】HDU 3652
B-number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2271 Accepted Submission(s): 1232 Problem Description A wqb-number, or B-nu
2014-07-12 21:36:04 379
原创 【数位dp】HDU 2089
不要62 Problem Description 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,61152
2014-07-12 21:29:27 394
原创 【数位dp】hdu3555
Bomb Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 6604 Accepted Submission(s): 2301 Problem Description The counter-terrorists f
2014-07-12 21:25:55 419
原创 校赛F,H题题解
题目: 喵星人吃土豆 时间限制:1s 内存限制:32MB 描述: 喵星人喵喵在到了地球以后爱上了吃土豆,并将土豆的种子带回了喵星球进行播种,但是他等啊等土豆都没有成熟…… …… 终于有一天,喵喵种的土豆奇迹般的收获了,于是他得到了很多很多的土豆(实在太多,数不过来,你可以认为是无穷个)。他将这很
2014-06-07 16:36:49 623
原创 【数位dp】bzoj1026
1026: [SCOI2009]windy数 Description windy定义了一种windy数。不含前导零且相邻两个数字之差至少为2的正整数被称为windy数。 windy想知道,在A和B之间,包括A和B,总共有多少个windy数? Input 包含两个整数,A B。 Output 一个整数。 Sample Input 【输入样例一】 1
2014-05-23 22:21:05 358
原创 【数位dp】hdu3555
Bomb Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If
2014-05-23 22:04:19 346
原创 【数位dp】hdu2089
不要62 Problem Description 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,6
2014-05-23 21:35:25 373
原创 【后缀数组】poj3294
Life Forms Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 8956 Accepted: 2476 Description You may have wondered why most extraterrestrial life forms resem
2014-04-22 17:37:49 341
原创 【后缀数组】poj1226
Substrings Description You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any o
2014-04-22 16:20:31 411
原创 【后缀数组】poj1743
Musical Theme Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but tr
2014-04-21 14:52:02 379
原创 【后缀数组】poj3261
Musical Theme Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 17176 Accepted: 5903 Description A musical melody is represented as a sequence of N (1<=N<=20
2014-04-21 14:39:32 420
原创 【树形dp】poj1463
Strategic game Time Limit: 2000MS Memory Limit: 10000K Total Submissions: 6089 Accepted: 2796 Description Bob enjoys playing computer games, especially strategic game
2014-04-16 13:14:04 442
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人