1 2 3 4

03 2020 档案

摘要:分层图,每个转弯定义为一个操作,所以建立一个上层全是x轴,下层全是y轴,两层之间连一条权值为1的边代表转弯的代价。。挺简单的其实 https://www.luogu.com.cn/problem/P3831 #include<iostream> #include<cstring> #include< 阅读全文
posted @ 2020-03-31 20:34 Lesning 阅读(128) 评论(0) 推荐(0) 编辑
摘要:https://ac.nowcoder.com/acm/contest/4090/F 8说了,就是个树链剖分 当xy之间的距离是奇数,就考虑重新建个1010101010--这样取值的树, 当xy之间距离是偶数,直接就完整的取异或就行了,没啥难得,树链剖分板子题8 #include<iostream> 阅读全文
posted @ 2020-03-26 19:46 Lesning 阅读(138) 评论(0) 推荐(0) 编辑
摘要:https://nanti.jisuanke.com/t/42552 以上是交题网站计蒜客 本题要求找到所有子树的所有重心 性质1 : 两棵树合并,新树的重心在两旧树重心连线上 性质2 :子树的重心一定在重儿子上 性质3 :树上所有点到重心的距离的和最小 当siz[root] - siz[x] > 阅读全文
posted @ 2020-03-24 17:58 Lesning 阅读(386) 评论(0) 推荐(0) 编辑
摘要:https://ac.nowcoder.com/acm/contest/4784/B 这题其实不难,考虑一下什么情况会让答案很大? 如果我想枚举,当p是一个很大的素数的时候就不行了,所以先下手为强,看看p/i是不是素数。 具体看代码就行,难度不大 #include<iostream> #includ 阅读全文
posted @ 2020-03-21 23:38 Lesning 阅读(339) 评论(2) 推荐(1) 编辑
摘要:这个差分约束真的想不到,说白了就是统计C和D https://www.luogu.com.cn/problem/P2474 哎不说了,建议看看原来的题解 #include<iostream> #include<cstring> #include<algorithm> #include<cstdio> 阅读全文
posted @ 2020-03-21 18:24 Lesning 阅读(152) 评论(0) 推荐(0) 编辑
摘要:2-SAT快忘了,回忆了一下 x >y 代表选择x必选择y #include<iostream> #include<algorithm> #include<cstring> #include<stack> #include<cstdio> using namespace std; const int 阅读全文
posted @ 2020-03-19 18:48 Lesning 阅读(108) 评论(0) 推荐(0) 编辑
摘要:https://www.luogu.com.cn/problem/P4438 这个神仙问题告诉我们,树形dp还是dp,动态规划是真的难,不会设转移方程要吃大亏 写成记忆话搜索是真的方便,服了 #include<iostream> #include<cstring> #include<cstdio> 阅读全文
posted @ 2020-03-18 19:20 Lesning 阅读(140) 评论(0) 推荐(0) 编辑
摘要:https://www.luogu.com.cn/problem/P1772 这是一个非常神奇的动态规划+最短路问题 #include<iostream> #include<cstring> #include<queue> #include<vector> using namespace std; 阅读全文
posted @ 2020-03-14 20:10 Lesning 阅读(87) 评论(0) 推荐(0) 编辑
摘要:差分约束问题(判定负环) #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<queue> using namespace std; const int INF = 1e9; const 阅读全文
posted @ 2020-03-12 18:38 Lesning 阅读(108) 评论(0) 推荐(0) 编辑
摘要:这题没啥可说的,就是线段树题, #include<cstring> #include<vector> #include<iostream> #include<algorithm> #include<cstdio> using namespace std; typedef long long ll; 阅读全文
posted @ 2020-03-11 23:31 Lesning 阅读(158) 评论(0) 推荐(0) 编辑
摘要:贪心+树形dp 尽可能低价买入,高价卖出 设好转移规律就好了 长记性 dp[i][1] i号节点或者他的某个子孙中最低买入价格//要靠考虑路费 dp[i][0] i号节点或者他的某个子孙中最高卖出价格//要考虑路费 #include<iostream> #include<cstring> #incl 阅读全文
posted @ 2020-03-09 23:57 Lesning 阅读(133) 评论(0) 推荐(0) 编辑
摘要:这题简直树链剖分板子题。。。。真没啥可说的。当时不懂树剖,可惜啦 #include<cstring> #include<iostream> #include<algorithm> #include<queue> using namespace std; typedef long long ll; c 阅读全文
posted @ 2020-03-06 18:50 Lesning 阅读(101) 评论(0) 推荐(0) 编辑
摘要:很神仙的题 https://www.luogu.com.cn/problem/P2486 大致如下图,我感觉本质还是数据结构线段树。 #include<cstring> #include<cstdio> #include<iostream> #include<algorithm> #include< 阅读全文
posted @ 2020-03-04 01:36 Lesning 阅读(112) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示