- 博客(21)
- 资源 (1)
- 收藏
- 关注
原创 poj1459Power Network
Time Limit: 2000MS Memory Limit: 32768KTotal Submissions: 24159 Accepted: 12596DescriptionA power network consists of nodes (power stations, consumers and dispatchers) connecte
2015-03-31 14:19:31 656
转载 树链剖分
“在一棵树上进行路径的修改、求极值、求和”乍一看只要线段树就能轻松解决,实际上,仅凭线段树是不能搞定它的。我们需要用到一种貌似高级的复杂算法——树链剖分。 树链,就是树上的路径。剖分,就是把路径分类为重链和轻链。 记siz[v]表示以v为根的子树的节点数,dep[v]表示v的深度(根深度为1),top[v]表示v所在的重链的顶端节点,fa[v]表示v的父亲,son[v]表示
2015-03-30 22:24:31 474
原创 hdu3966 Aragorn's Story
Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4217 Accepted Submission(s): 1164Problem DescriptionOur protagonist is the hands
2015-03-30 22:19:32 673
原创 Codeforces Round #297 (Div. 2) D. Arthur and Walls
time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputFinally it is a day when Arthur has enough money for buying an apartment.
2015-03-27 05:22:40 826
原创 ZOJ 3769 Diablo III
Diablo IIITime Limit: 2 Seconds Memory Limit: 65536 KB Diablo III is an action role-playing video game. A few days ago, Reaper of Souls (ROS), the new expansion of Diablo III, has b
2015-03-26 20:53:15 994 1
转载 组合数对素数取模 Lucas定理
Lucas 定理:A、B是非负整数,p是质数。AB写成p进制:A=a[n]a[n-1]...a[0],B=b[n]b[n-1]...b[0]。则组合数C(A,B)与C(a[n],b[n])*C(a[n-1],b[n-1])*...*C(a[0],b[0]) modp同即:Lucas(n,m,p)=c(n%p,m%p)*Lucas(n/p,m/p,p)
2015-03-20 17:09:06 1252
原创 hdu3037Saving Beans
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2610 Accepted Submission(s): 966Problem DescriptionAlthough winter is far awa
2015-03-20 17:06:06 875
原创 csu1527: Bounty Hunter
Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu SubmitStatus Practice CSU 1527 DescriptionInputOutputSample Input
2015-03-19 20:40:51 1426
原创 Codeforces Round #296 (Div. 2) C. Glass Carving
C. Glass Carvingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLeonid wants to become a glass carver (the
2015-03-18 16:52:50 738
原创 UVA - 753 A Plug for UNIX
Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionYou are in charge of setting up the press room for the inaugural meeting
2015-03-16 19:59:04 838
转载 康托展开
康托展开 康托展开的公式是 X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0! 其中,ai为当前未出现的元素中是排在第几个(从0开始)。 这个公式可能看着让人头大,最好举个例子来说明一下。例如,有一个数组 s = ["A", "B", "C", "D"],它的一个排列 s1 = ["D", "B", "A", "C"],现在要
2015-03-15 11:11:58 415
原创 Narrow Art Gallery
Time Limit: 4000ms, Special Time Limit:10000ms, Memory Limit:65536KBTotal submit users: 11, Accepted users: 9Problem 13240 : No special judgementProblem descriptionA long art
2015-03-14 21:15:01 1273
原创 hdu5119Happy Matt Friends
Happy Matt FriendsTime Limit: 6000/6000 MS (Java/Others) Memory Limit: 510000/510000 K (Java/Others)Total Submission(s): 700 Accepted Submission(s): 270Problem DescriptionMatt has N
2015-03-11 17:12:28 739
原创 hdu5115 Dire Wolf
Dire WolfTime Limit: 5000/5000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 436 Accepted Submission(s): 251Problem DescriptionDire wolves, als
2015-03-08 21:02:08 750
原创 poj2001Shortest Prefixes
Shortest PrefixesTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 14452 Accepted: 6230DescriptionA prefix of a string is a substring starting at the begi
2015-03-08 16:04:17 706
转载 欧几里德与扩展欧几里德算法
欧几里德算法欧几里德算法又称辗转相除法,用于计算两个整数a,b的最大公约数。基本算法:设a=qb+r,其中a,b,q,r都是整数,则gcd(a,b)=gcd(b,r),即gcd(a,b)=gcd(b,a%b)。第一种证明: a可以表示成a = kb + r,则r = a mod b 假设d是a,b的一个公约数,则有 d|a, d|b,而
2015-03-08 15:08:03 545
原创 hdu5128 The E-pang Palace
The E-pang PalaceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 1073 Accepted Submission(s): 766Problem DescriptionE-pang Pala
2015-03-07 18:24:17 875
原创 csu1510: Happy Robot
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 41 Solved: 19[Submit][Status][Web Board]DescriptionInputThere will be at most 1000 test cases. Each case contains a command
2015-03-06 22:20:43 1275
原创 hdu2586How far away ?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6456 Accepted Submission(s): 2432Problem DescriptionThere are n houses in the v
2015-03-01 22:55:39 715
转载 LCA在线算法ST算法
求LCA(最近公共祖先)的算法有好多,按在线和离线分为在线算法和离线算法。离线算法有基于搜索的Tarjan算法较优,而在线算法则是基于dp的ST算法较优。首先说一下ST算法。这个算法是基于RMQ(区间最大最小值编号)的,不懂的可以这里学习一些而求LCA就是把树通过深搜得到一个序列,然后转化为求区间的最小编号。比如说给出这样一棵树。
2015-03-01 19:45:35 551
原创 Codeforces Round #294 (Div. 2)D. A and B and Interesting Substrings
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA and B are preparing themselves for programming contests.Af
2015-03-01 10:14:40 2335
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人