ccc
文章平均质量分 77
alancodes
这个作者很懒,什么都没留下…
展开
-
ccc 16 s4 Combining Riceballs
Alphonse has N rice balls of various sizes in a row. He wants to form the largest rice ball possible for his friend to eat. Alphonse can perform the following operations:• If two adjacent rice balls原创 2016-08-30 22:52:51 · 502 阅读 · 0 评论 -
ccc 2016 s4 Combining Riceballs
Problem DescriptionAlphonse has N rice balls of various sizes in a row. He wants to form the largest rice ball possiblefor his friend to eat. Alphonse can perform the following operations:• If two原创 2016-08-30 23:07:21 · 448 阅读 · 0 评论 -
ccc 2016 s4
#include #include #include using namespace std;const int maxn = 400 + 5;int n; int a[maxn]; int s[maxn];void init() { scanf("%d", &n); for (int i = 0 ; i < n; i++) scanf("%d", &a[i]); s[0]原创 2016-08-30 23:11:08 · 201 阅读 · 0 评论 -
ccc 2016 s3
把选中的点和它们的lca标记一下,然后考虑标记的点组成的这棵树。答案是:路径长度和 * 2 - 直径想办法把选中的点和连接它们的点和边弄出来重新建棵树以一个选中的点作为根,然后dfs,对每一个非选中的点,根据子树是否有选中的点来决定它是否要选复杂度为 O(n)原创 2016-08-30 23:24:45 · 272 阅读 · 0 评论