- 博客(13)
- 收藏
- 关注
原创 Hdu-4757 Tree(可持久化字典树)
Problem Description Zero and One are good friends who always have fun with each other. This time, they decide to do something on a tree which is a kind of graph that there is only one path from nod
2017-02-28 17:52:07 502
原创 Codeforces Round #402 (Div. 1) C. Peterson Polyglot(字典树合并/可持久化字典树)
Peterson loves to learn new languages, but his favorite hobby is making new ones. Language is a set of words, and word is a sequence of lowercase Latin letters. Peterson makes new language every mo
2017-02-28 11:15:37 991 2
原创 Codeforces Round #397 F. Souvenirs(线段树,离线)
Artsem is on vacation and wants to buy souvenirs for his two teammates. There are n souvenir shops along the street. In i-th shop Artsem can buy one souvenir for ai dollars, and he cannot buy more
2017-02-23 15:58:05 413
原创 ICPCCamp 2017 Day 6: U of Tokyo Selection 1 - Problem A. Spanning Trees
题意:给一个N个点的完全图,让你输出k个边不重复的生成树。 分析:如果k > n/2直接无解,否则我们用类似数学归纳法的方法构造;可以发现从2开始才有解,而且n每增加2其构造方案数才能+1,当n为奇数时,我们可以让第n个点直接向前边的点连边来继承n-1的所有方案;当n为偶数时,我们可以直接继承n-2的所有方案,并且让[1,(n-2)/2]的边连向n-1,[(n-2)/2+1,n-
2017-02-20 09:05:37 515
原创 ICPCCamp 2017-Day1 E.Lowest Common Ancestor(树链剖分/lct)
题意:给一棵带权树,问每个点和所有标号小于它的点的带权lca和。 分析:这种lca和可以看成是两段权值不同的链的差,这样我们用lct来维护树上每段链的带权重量和,每次插入一个点。 #include #include #include #include #include #include #include #include #include #include #include #
2017-02-13 08:52:36 396
原创 2016-2017 ACM-ICPC, NEERC, Southern Subregional Contest - J. Bottles(DP)
Nick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda ai and bottle volumebi (ai ≤ bi). Nick has decided to pour all remaining soda
2017-02-09 22:01:43 647
原创 Codeforces Round #215 (Div. 1) C. Sereja and the Arrangement of Numbers(欧拉图)
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property: consider all pairs of numbers x, y (x ≠ y), such that number x occurs in the a
2017-02-09 20:28:02 375
原创 RCC 2014 Warmup (Div. 2) D. Cunning Gena(状压DP)
A boy named Gena really wants to get to the "Russian Code Cup" finals, or at least get a t-shirt. But the offered problems are too complex, so he made an arrangement with his n friends that they wil
2017-02-07 21:50:33 269
原创 Codeforces Beta Round #11 D. A Simple Task(状压DP)
Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or edges. Input The first line of input contains two integers n and m (1 ≤ n ≤ 19,
2017-02-06 16:11:38 472
原创 Codeforces Round #395 (Div. 1) E. Timofey and our friends animals(lct动态维护mst)
After his birthday party, Timofey went to his favorite tree alley in a park. He wants to feed there his favorite birds — crows. It's widely known that each tree is occupied by a single crow family.
2017-02-03 17:48:53 468
原创 Codeforces Round #259 (Div. 1) B. Little Pony and Harmony Chest(状压dp)
Princess Twilight went to Celestia and Luna's old castle to research the chest from the Elements of Harmony. A sequence of positive integers bi is harmony if and only if for every two elements
2017-02-03 11:08:26 612
原创 LA-4727 Jump(递推)
题意:给定n和k,问每隔k人的n人约瑟夫游戏中最后出局的三个人的编号。 分析:设f(i,j)表示共i个人的约瑟夫环中出局的第j个人的编号,我们每出局一个人重新编号后有f(i,j) = (f(i-1,j-1) + k) % i. #include #include #include #include #include #include #include #include
2017-02-01 22:12:06 267
原创 Hdu-5806 NanoApe Loves Sequence(尺取法)
NanoApe, the Retired Dog, has returned back to prepare for for the National Higher Education Entrance Examination! In math class, NanoApe picked up sequences once again. He wrote down a sequence w
2017-02-01 16:24:47 526
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人