摘要: 传送门:http://codeforces.com/problemset/problem/609/D(如需转载,请注明出处,谢谢O(∩_∩)O)题意:Nura想买k个小玩意,她手上有 s 个burles(一种货币),有m个小玩意供她选择购买,但每个小玩意只能用dollars或者pounds来购买,所... 阅读全文
posted @ 2015-12-24 09:49 轶辰 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 参考:http://www.xuebuyuan.com/609502.html先说题意: 给出一幅图,求最大生成树,并在这棵树上进行查询操作:给出两个结点编号x和y,求从x到y的路径上,由每个结点的权值构成的序列中的极差大小——要求,被减数要在减数的后面,即形成序列{a1,a2…aj …ak…an}... 阅读全文
posted @ 2015-10-30 11:47 轶辰 阅读(371) 评论(0) 推荐(0) 编辑
摘要: 有两个基础需要掌握:RMQ,以及LCA。RMQ:dp[i][j]表示下标从i开始,长度为2^j的一段元素中的最值。则易得状态转移如下:dp[i][j]=max/min(dp[i][j-1],dp[i+2^j-1][j-1];LCA:最近公共祖先结点的求法:可先进行一次dfs得到欧拉序列。比如对,得到... 阅读全文
posted @ 2015-10-15 19:12 轶辰 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一棵树,树上有 n 个节点。问有多少种方案,使得在每个节点上依次放置数 1~n 后,每个节点的儿子节点上的数连续(比如 1 为根,有1-2,1-3,1-4,则令2,3,4上的数连续),每个子树上的数连续。注释在代码里。#pragma comment(linker, "/STACK:1024... 阅读全文
posted @ 2015-08-15 14:51 轶辰 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5352看题看得心好累。题目大意:给出 n 个点,依次执行 m 次操作:输入“1 x”时,表示将与 x 连通的点全部修复;输入“2 x y”,表示在 x 与 y 之间加一条边;输入“3 x y”,表示删除 ... 阅读全文
posted @ 2015-08-08 17:16 轶辰 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5348题目大意:给出一幅无向图,问是否存在一种方案,使得给每条边赋予方向后,每个点的入度与出度之差小于等于1。如不存在,输出-1;存在,则按边的输入顺序输出方向。比如:若给出第 m 条边为 u,v,则在对... 阅读全文
posted @ 2015-08-08 11:48 轶辰 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionXYZ is playing an interesting game called "drops". It is played on ar∗cgrid. Each grid cell is either empty, or occupied by a water... 阅读全文
posted @ 2015-08-04 21:09 轶辰 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIn ann∗mmaze, the right-bottom corner is the exit (position(n,m)is the exit). In every position of this maze, there is either a0or ... 阅读全文
posted @ 2015-08-04 20:55 轶辰 阅读(148) 评论(0) 推荐(0) 编辑
摘要: DescriptionMr. Hdu is interested in Greatest Common Divisor (GCD). He wants to find more and more interesting things about GCD. Today He comes up with... 阅读全文
posted @ 2015-08-04 20:44 轶辰 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThere arenpeople andmpairs of friends. For every pair of friends, they can choose to become online friends (communicating using onl... 阅读全文
posted @ 2015-08-04 20:37 轶辰 阅读(111) 评论(0) 推荐(0) 编辑