- 博客(5)
- 收藏
- 关注
原创 ccc 2016 s3
把选中的点和它们的lca标记一下,然后考虑标记的点组成的这棵树。答案是:路径长度和 * 2 - 直径 想办法把选中的点和连接它们的点和边弄出来重新建棵树 以一个选中的点作为根,然后dfs,对每一个非选中的点,根据子树是否有选中的点来决定它是否要选 复杂度为 O(n)
2016-08-30 23:24:45 272
原创 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
原创 ccc 2016 s4 Combining Riceballs
Problem Description Alphonse 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
原创 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 503
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人