- 博客(40)
- 收藏
- 关注
原创 POJ 3783 (DP)
BallsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 875 Accepted: 577DescriptionThe classic Two Glass Balls brain-teaser is often posed as: "Given
2016-03-31 18:14:09 968
原创 HDU 5299 (树删边博弈)
Circles GameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1446 Accepted Submission(s): 456Problem DescriptionThere are n ci
2016-03-30 23:23:48 1047
原创 Codeforces 639C (数学)
C. Bear and Polynomialstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLimak is a little polar bear. He do
2016-03-29 14:53:59 463
原创 Codeforces 639B (构造)
C. Bear and Forgotten Tree 3time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA tree is a connected undirect
2016-03-29 14:43:03 386
原创 Codeforces 639A (set 水~)
A. Bear and Displayed Friendstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLimak is a little polar bear.
2016-03-29 14:38:43 442
原创 HDU 3094 (博弈 树DP)
A tree gameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 624 Accepted Submission(s): 335Problem DescriptionAlice and Bob wa
2016-03-28 23:16:04 455
原创 HDU 5654 (树状数组 离散化)
xiaoxin and his watermelon candyTime Limit: 4000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 243 Accepted Submission(s): 64Problem Description
2016-03-28 22:20:24 411
原创 HDU 5653 (DP)
Bomber Man wants to bomb an Array.Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 143 Accepted Submission(s): 43Problem Descripti
2016-03-26 23:36:32 620
原创 HDU 5652 (二分 bfs)
India and China OriginsTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 235 Accepted Submission(s): 72Problem DescriptionA lon
2016-03-26 23:29:48 601
原创 HDU 5651 (组合 水~)
xiaoxin juju needs helpTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 431 Accepted Submission(s): 123Problem DescriptionAs w
2016-03-26 23:26:07 716
原创 Codeforces 622F (拉格朗日插值 费马小定理)
做这个题之前需要知道一些知识:拉格朗日插值:n-1次多项式可以用n个点唯一确定,插值公式是:费马小定理:a^(p-1)≡1(如果p是素数),也就是说模p时a和a^(p-2)互为逆元关于模:
2016-03-26 18:09:56 1971
原创 Codeforces 622E (树DP)
E. Ants in Leavestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTree is a connected graph without cycles.
2016-03-26 01:37:20 354
原创 Codeforces 622C (vector 二分)
题目:点击打开链接题意:给出n个预处理每个数右边第一个不等于自己的下标,用向量存下每一个数字的出现的位置,然后对于询问的数字x,二分找[l,r]中第一次出现的x的位置p,如果p大于l或者不存在那么l就合理,否则判断l右边第一个不等于x的下标是不是#include using namespace std;#define maxn 1000005vector gg[max
2016-03-25 15:02:37 391
原创 gym 100935E (数学推导 水~)
E. Pairstime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputIn the secret book of ACM, it’s said: “Glory for th
2016-03-25 11:47:53 360
原创 gym 100935B (字典树)
B. Weird Cryptographytime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputKhaled was sitting in the garden under
2016-03-24 23:32:13 492
原创 NEU 1690 (最短路+LCA)
1690: Terrorists时间限制: 5 Sec 内存限制: 128 MB提交: 11 解决: 3[提交][状态][讨论版]题目描述Terrorists! There are terrorists everywhere!!! I was shouting out loud after I had watched a few newsreports abou
2016-03-23 17:43:35 494
原创 Codeforces 653E (BFS set)
E. Bear and Forgotten Tree 2time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA tree is a connected undirect
2016-03-22 23:30:47 453
原创 Codeforces 645E (构造 DP)
E. Intellectual Inquirytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter getting kicked out of her rep
2016-03-22 21:03:39 487
原创 UVALive 7037 (最大密度子图 网络流)
每个数都看成一个节点,每个逆序对之间的节点连边,于是只需要求出这个图的最大密度子图,可以用最小割模型解决.#include #include #include #include #include #include #include using namespace std;const double INF = 1e8;#define maxn 1511#define maxm
2016-03-22 16:15:05 760
原创 POJ 2987 (最大权闭合图 最小割)
FiringTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 9493 Accepted: 2850DescriptionYou’ve finally got mad at “the world’s most stupid” employees of
2016-03-21 22:13:16 400
原创 codeforces 653D (二分 最大流)
D. Delivery Bearstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNiwel is a little golden bear. As everyon
2016-03-21 20:34:04 611
原创 UVA 1515 (最小割)
额...感觉关键还是要看出是最小割,然后用割的思想去考虑怎么建图...然后慢一点的最大流方法会被卡掉#include #include #include #include #include #include #include using namespace std;const int INF = 1e8;#define maxn 3333#define maxm 411
2016-03-18 21:33:23 283
原创 UVA 1658 (费用流)
求两条不相交从1到n路径的长度和的最小值.每个点拆成入点出点,流量1费用为边权,拆成的两个点流量为1费用为0,除了源点和汇点流量为2.#include #include #include #include #include #include #include using namespace std;#define INF 11111111#define maxn 2111
2016-03-18 14:14:57 399
原创 UVA 11082 (最大流)
#include #include #include #include #include #include #include using namespace std;#define INF 11111111#define maxn 111#define maxm 4111int n, m;int s, t;struct Edge{ int from, to,
2016-03-18 12:06:11 279
原创 UVA 753 (最大流)
构图很直接.坑:样例之间的空行,转换器之间的对接,转换器有无限多个所以和转换器有关的容量都是无穷.#include #include #include #include #include #include #include using namespace std;#define INF 11111111#define maxn 311#define maxm 21111
2016-03-18 11:18:06 285
原创 POJ 2728 (最优比率生成树+二分或者迭代)
Desert KingTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 23100 Accepted: 6478DescriptionDavid the Great has just become the king of a desert country.
2016-03-16 18:46:37 329
原创 POJ 2976 (二分)
Dropping testsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8735 Accepted: 3043DescriptionIn a certain course, you take n tests. If you get ai out of
2016-03-16 16:54:52 278
原创 UVA 12298 (FFT)
题意:给定一个区间[a,b],给定四种花色的纸牌,每张牌上都有一个合数.对于每一个n属于[a,b]四种牌中各取一张和等于n的方案数.然后限制条件是有几种牌遗失了.裸的fft,找出所有的合数记录下来然后去掉遗失的,对每个花色FFT,然后四个花色的点表达式相乘求出IDFT就是方案数了~坑点:所有的都要换成long double!!!#include #include #include
2016-03-16 13:31:11 333
原创 CodeChef Arithmetic Progressions (分块FFT)
题意:给出 A 1 ,A 2 ,...,A N 统计满足:▶ i ▶ A i + A k = 2A j的 (i,j,k) 数量。(N ≤ 30000,A i ≤ 10 5 )分块,把长度为n的序列分成sqrt(n)块长度为sqrt(n)的序列,然后遍历每一个块分三种情况:1)三个都在同一个块里面:暴力枚举后两个,每次维护前面的数的个数,复杂度O(sqrt(n)*n)
2016-03-15 21:12:55 481
原创 FFT,NTT学习笔记
快速傅里叶变换,可以将多项式相乘的时间复杂度从最简单的O(n^2)优化到O(nlgn),详细过程参考算法导论.FFT的流程大致是:1):构造多项式,复杂度O(n)2):求两个多项式的DFT,复杂度O(nlgn)3):构造多项式乘积的点值表达式,复杂度O(n)4):求点值表达式的IDFT,复杂度O(nlgn).下面是两道最简单的习题:HDU 1402:点击打开链接
2016-03-15 19:28:12 1385
原创 UVALive 7040 (容斥)
题意:n朵花,从m种颜色中选择k种颜色使得相邻花不同色的方案数.对于比较小的数据,这道计数题可以用DP做,DP[i][j]表示染i朵花用了j种颜色的方案数,那么对于后i-1朵花,要么用了j种颜色,要么用了j-1种颜色,转移方程也就很简单了DP[i][j] = j*(DP[i-1][j-1]+DP[i-1][j]).但是这题的数据比较大,所以考虑容斥原理.首先组合数递推公式:
2016-03-13 22:31:28 622 2
原创 HDU 5643 (神奇的打表 线段树)
King's GameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 263 Accepted Submission(s): 154Problem DescriptionIn order to reme
2016-03-13 18:35:14 415
原创 HDU 5642 (DP)
King's OrderTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 280 Accepted Submission(s): 167Problem DescriptionAfter the king'
2016-03-13 18:30:29 364
原创 POJ 3904 (莫比乌斯反演)
Sky CodeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1964 Accepted: 629DescriptionStancu likes space travels but he is a poor software developer and
2016-03-11 20:47:37 543
原创 莫比乌斯反演学习笔记
莫比乌斯反演的形式:另一种描述是:一种是和所有的约数有关一种是和所有的倍数有关,解题的时候要根据题目选择合适的表达形式,感觉第二种用的比较多。关于莫比乌斯函数mu,他的定义如下:这个莫比乌斯函数有一些性质:(1)(2)一般需要预处理所有的莫比乌斯函数值,需要用到线性筛mu[1] = 1;for (int i = 2;
2016-03-09 20:24:59 1057
原创 POJ 2311 (博弈 sg函数)
Cutting GameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3544 Accepted: 1318DescriptionUrej loves to play various types of dull games. He usually ask
2016-03-07 16:57:48 293
原创 POJ 1704 (博弈)
Georgia and BobTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 8724 Accepted: 2783DescriptionGeorgia and Bob decide to play a self-invented game. They d
2016-03-07 15:49:33 307
原创 POJ 2348 (博弈)
Euclid's GameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8502 Accepted: 3451DescriptionTwo players, Stan and Ollie, play, starting with two natural
2016-03-07 14:49:15 241
原创 POJ 2484 (博弈)
A Funny GameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4695 Accepted: 2900DescriptionAlice and Bob decide to play a funny game. At the beginning of
2016-03-07 12:37:51 264
原创 codeforces 631B (STL set)
B. Print Checktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKris works in a large company "Blake Technolo
2016-03-05 23:53:16 586
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人