上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页
摘要: 传送门:http://www.lydsy.com:808/JudgeOnline/problem.php?id=4027 思路:自底向上贪心。 设f[i]表示i的子树中最多能删多少点, g[i]表示i的子树删去f[i]个点后的重量。 每次给儿子按g[son[i]]排序,贪心地从小到大删,直到不能... 阅读全文
posted @ 2015-10-29 09:50 orzpps 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://www.lydsy.com:808/JudgeOnline/problem.php?id=2067 思路:首先第一问就是最少多少笔画完这个图,ans=1+Σ(deg[i]-1)/2 第二问显然可以二分+判定。 先二分最长长度限制lim 怎么判定呢? 对于每个点,把它子树... 阅读全文
posted @ 2015-10-29 09:42 orzpps 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://www.lydsy.com:808/JudgeOnline/problem.php?id=2071 题目大意:在Byteotia有一个洞穴. 它包含n 个洞室和一些隧道连接他们. 每个洞室之间只有一条唯一的路径连接他们. Hansel 在其中一个洞室藏了宝藏, 但是它不会说... 阅读全文
posted @ 2015-10-28 17:18 orzpps 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1063 思路:首先m#include#includeconst int maxn=100010,maxm=200010,lim=10;typedef long long ll;usi... 阅读全文
posted @ 2015-10-27 17:35 orzpps 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/problemset/problem/582/C 思路:首先观察题目条件,对于一个数a[i]能出现在“Superior Periodic Subarrays” 首先它要满足对于任意k属于N,a[i]>=a[i+k*n] 并且对于任意k属于N... 阅读全文
posted @ 2015-10-25 20:20 orzpps 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/problemset/problem/585/d 思路:中途相遇法 前一半暴力枚举,后一半暴力枚举,在hash表里查找是否有合法的方案即可,输出方案在hash表存一个3进制数即可 #include#include#includeconst in... 阅读全文
posted @ 2015-10-25 20:09 orzpps 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/problemset/problem/581/F F. Zublicanes and Mumocrates time limit per test 3 seconds memory limit per test 512 m... 阅读全文
posted @ 2015-10-24 15:21 orzpps 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/problemset/problem/580/E E. Kefa and Watch time limit per test 1 second memory limit per test 256 megabytes inpu... 阅读全文
posted @ 2015-10-24 11:40 orzpps 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/problemset/problem/578/c 思路:设f(x)为取x时的最大子段和,f(x)是先减后增的,于是可以用三分法求最值 先确定初始区间[l,r],mid1=(l+r)/2,mid2=(mid1+r)/2 O(n)求出f(mid1)... 阅读全文
posted @ 2015-10-23 17:03 orzpps 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/problemset/problem/573/d 思路:首先如果没有限制,那么根据排序不等式,肯定按顺序匹配战士和马最好。 但是现在有了战士不能和自己的马匹配的限制。 于是就有了一个重要的性质: 最优匹配的前提下,排序后第i号战士只会与[i-2... 阅读全文
posted @ 2015-10-23 16:43 orzpps 阅读(323) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页