上一页 1 2 3 4 5 6 ··· 8 下一页
  2016年11月14日
摘要: 画个图就能多少看出些规律 证明借鉴一下大牛的题解: 设从A到B,经过的深度最小的点为X 同理,C,D的为Y 题目是一个点从A出发到B 一个从C出发到D 那么从A到B可以分解成 先从A到X 再从X到B。。。 C同理 假设能相遇 那么 要么在A到X的过程A,B相遇 要么在X到B的过程A,B相遇 对于在A 阅读全文
posted @ 2016-11-14 08:37 Absolutezero 阅读(358) 评论(0) 推荐(0) 编辑
  2016年11月12日
摘要: 很好的一道题 LCA+树上前缀和 sum数组是前缀和数组, 分类讨论一下, 1.访问到一个点p1,若下一个点p2需要往儿子下面找的话,那么lca就是这个点p1,则sum[p1]--; sum[p2]++; 2.访问到一个点p1,若下一个点p2需要往父亲上找的话,那么lca就是p2,则sum[f[p2 阅读全文
posted @ 2016-11-12 23:06 Absolutezero 阅读(333) 评论(0) 推荐(0) 编辑
  2016年11月9日
摘要: 搜索…… PS一个坑点:r<=0时并不是舍弃这种情况,而是让r=0 (因为每个点都要放一滴油)(读题啊!) 1 #include<cstdio> 2 #include<cstring> 3 #include<cmath> 4 #define dd double 5 using namespace s 阅读全文
posted @ 2016-11-09 15:57 Absolutezero 阅读(163) 评论(0) 推荐(0) 编辑
  2016年11月7日
摘要: 树形dp 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int N=6010; 6 int f[N][2],w[N],in[N],out[N],n; 7 int 阅读全文
posted @ 2016-11-07 17:55 Absolutezero 阅读(177) 评论(0) 推荐(0) 编辑
  2016年11月1日
摘要: 递增区间内累计增量 1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 int a,h,n,ans; 5 int main(){ 6 a=ans=0; 7 scanf("%d",&n); 8 for (int i=1;i<= 阅读全文
posted @ 2016-11-01 18:11 Absolutezero 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 我们枚举中间点,当连的点数不小于2时进行处理 最大值好搞 求和:设中间点 i 所连所有点权之和为sum 则对于每个中间点i的联合权值之和为: w[j]*(sum-w[j])之和 1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 阅读全文
posted @ 2016-11-01 10:34 Absolutezero 阅读(219) 评论(0) 推荐(0) 编辑
摘要: f [ i ] [ j ] 表示横坐标为 i ,高度为 j 时的最小点击次数 分别dp处理: 1.上升,(1)<m (2)>=m 2.下降 3.管道 1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 const int N 阅读全文
posted @ 2016-11-01 09:59 Absolutezero 阅读(145) 评论(0) 推荐(0) 编辑
  2016年10月31日
摘要: 四维dp 1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 const int N=41; 5 int f[N][N][N][N],g[356],a,b,c,d,n,m; 6 int max(int x,int y){ 7 阅读全文
posted @ 2016-10-31 20:45 Absolutezero 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 我们按照左右手数的乘积升序排序,就能使最多金币数最小了 为什么呢? 我们知道: 1)如果相邻的两个人交换位置,只会影响到这两个人的值,不会影响他人 2)假设相邻的两个人i, i + 1。设A[i] B[i] <= A[i + 1] B[i + 1],i之前所有人的左手乘积为S。 ans1 = max 阅读全文
posted @ 2016-10-31 19:14 Absolutezero 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 反正图两边bfs 1 #include<iostream> 2 #include<cstdio> 3 #include<queue> 4 5 using namespace std; 6 7 inline int readint(){ 8 int x=0,f=1; 9 char ch=getchar 阅读全文
posted @ 2016-10-31 18:49 Absolutezero 阅读(278) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页