会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
1
2 3 4
Lesning
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
9
···
20
下一页
2020年11月2日
P6554 Promises I Can't Keep
摘要: 这是一个非常有趣(not intersting)的题 传送门 https://www.luogu.com.cn/problem/P6554 dp[x] = sigm dp[p] + list[x]*cnt[x] ans = dp[x] / cnt[x] 利用换根dp枚举一下就好了,转移有点恶心,因为
阅读全文
posted @ 2020-11-02 22:34 Lesning
阅读(96)
评论(0)
推荐(0)
2020年10月31日
CodeForces - 1430E String Reversal
摘要: https://codeforces.com/problemset/problem/1430/E CF的E题每次都有新发现 这题其实是逆序对,树状数组求逆序对,没事了 以后见到反转次数,先想逆序对 #include<iostream> #include<cstring> #include<queue
阅读全文
posted @ 2020-10-31 11:53 Lesning
阅读(100)
评论(0)
推荐(0)
2020年10月30日
还没写好的博客
摘要: #include<iostream> #include<cstring> #include<queue> #include<vector> using namespace std; const int maxn = 3e5+11; vector<int>G[maxn]; void add(int x
阅读全文
posted @ 2020-10-30 15:40 Lesning
阅读(45)
评论(0)
推荐(0)
CodeForces - 1437E Make It Increasing 线段树动态开点
摘要: https://codeforces.com/problemset/problem/1437/E 这是有限制的最长上升子序列 数字之间必须满足list[i] - list[j] >= i - j 处理的时候就是让list[i] - i,这样就得到了最长不下降子序列,非正数就赋成INF忽略不计,就可以
阅读全文
posted @ 2020-10-30 13:41 Lesning
阅读(97)
评论(0)
推荐(0)
2020年10月29日
CodeForces - 1436E Complicated Computations
摘要: https://codeforces.com/problemset/problem/1436/E 这个题是个线段树 问你子串的mex 的mex 如果子串 的mex没有4,则没有办法分割出 存在1 存在2 存在3 不存在4 的字串出来,所以可以枚举,当前数字是list[i],记录之前list[i]出现
阅读全文
posted @ 2020-10-29 09:53 Lesning
阅读(148)
评论(0)
推荐(0)
2020年10月27日
CodeForces - 1436D Bandit in a City
摘要: https://codeforces.com/problemset/problem/1436/D 这题就是让村名尽可能集中在叶子上,但是可能叶子上本来就有很多村民,就是这样。 假设 1. mx[x]为在x点可以抓到的最多的人 2. chal[x]为 在x点还差chal[x]人就可以让x下面所有叶子都
阅读全文
posted @ 2020-10-27 19:02 Lesning
阅读(186)
评论(0)
推荐(0)
2020年10月26日
2020ccpc威海 Rencontre
摘要: 太可惜了,难过 真的难受啊 对于树上三个点a,b,c 汇于一个点的最短路和 ans,有dis(a,b) + dis(b,c) + dis(c,a) = ans * 2 知道这个以后就可以用换根dp解决了,假设dp[x][i]表示所有i颜色的节点到x的距离和 具体可以看代码, 注意答案会爆long l
阅读全文
posted @ 2020-10-26 20:41 Lesning
阅读(653)
评论(0)
推荐(0)
2020年10月24日
2020CCPC秦皇岛 打铁的网络现场赛 参赛总结
摘要: 三个题,铁了。 那个k题我比赛时候又两个想法,第一个是对的,第二个是错的。 我疯狂的在写第二个错误的想法。 比赛结束三天后,我把第一个想法完整写了一遍,一下就AC了。或许就差一点点,或许还是实力不够,不知道,也不想知道 //现在是2020年 10-24 10:30,下午打威海热身赛,打完威海后继续更
阅读全文
posted @ 2020-10-24 10:48 Lesning
阅读(263)
评论(0)
推荐(0)
CF1249F Maximum Weight Subset 树形dp
摘要: https://www.luogu.com.cn/problem/CF1249F 这题看题解云里雾里的,我自认为我写的比较简单; dp[x][i]表示以x为根,选中节点离x最近距离为i。(最小深度) 那么如何转移呢? 答案无非就是两种方式构成的,原来子树上就有,两棵树合并而成。于是就有了下面的式子
阅读全文
posted @ 2020-10-24 10:08 Lesning
阅读(165)
评论(0)
推荐(0)
2020年10月23日
P1272 重建道路
摘要: https://www.luogu.com.cn/problem/P1272 一个神奇的树形dp,大概就是下面这样转移的吧 dp[x][i]表示x为根,保留i个点最少删除几条边 #include<iostream> #include<vector> #include<algorithm> #incl
阅读全文
posted @ 2020-10-23 20:36 Lesning
阅读(105)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
9
···
20
下一页
公告