上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: 抄完题解之好像不难系列 求最小,用dfs,尽可能选择相邻的点对,如果以某个儿子为顶点的子树sz为odd,则儿子v与当前节点u所连的边必取,儿子v的其余点两两相连1,与u无关。 因此,只需要统计子树大小为奇数的v与其父亲u之间这条边的权值。 求最大,同样基于dfs。画一张图我们可以看出来,越靠近“中间 阅读全文
posted @ 2021-02-02 21:29 LegendN 阅读(63) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.ml/contest/1465/problem/E 好题好题 做不来的都是好题[滑稽] 写的太好了555 羡慕这样的博客 https://www.cnblogs.com/dysyn1314/p/14183815.html 图片截取自上述链接 1 #include 阅读全文
posted @ 2021-01-18 20:54 LegendN 阅读(196) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.ml/contest/1465/problem/D 参考:https://www.cnblogs.com/JDFZ-ZZ/p/14171488.html & https://blog.csdn.net/weixin_43918473/article/detail 阅读全文
posted @ 2021-01-18 15:04 LegendN 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N = 1e5 + 10; 4 int f[N]; 5 6 inline int find(int x) 7 { 8 return (f[x] == x) ? x : f[x] 阅读全文
posted @ 2021-01-18 12:16 LegendN 阅读(87) 评论(0) 推荐(0) 编辑
摘要: unique&erase: https://blog.csdn.net/hellokandy/article/details/51317593 参考博文:https://www.cnblogs.com/DeepJay/p/14115735.html 这个代码是真的简洁清晰,看的太舒服了 https: 阅读全文
posted @ 2021-01-18 11:02 LegendN 阅读(98) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.ml/contest/1409/problem/B 我是蠢蛋 1 #include<bits/stdc++.h> 2 #define ll long long 3 using namespace std; 4 5 inline ll min(ll a, ll b 阅读全文
posted @ 2021-01-16 19:54 LegendN 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 巧用队列+树状数组求逆序对 1 #include<bits/stdc++.h> 2 #define ll long long 3 using namespace std; 4 const int N = 2e5 + 10; 5 ll pos[N], t[N]; 6 int n; 7 8 inline 阅读全文
posted @ 2021-01-15 16:48 LegendN 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 好题 看似线段树的nlogn 实则是multiset + pair 1 #include<bits/stdc++.h> 2 #define fi first 3 #define se second 4 #define ll long long 5 using namespace std; 6 con 阅读全文
posted @ 2021-01-14 16:34 LegendN 阅读(76) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.ml/contest/1428/problem/E 优先队列题,需要维护的东西是将一个萝卜拆成t份的获得值: 假设当前它被均分为t - 1份,则拆分为t份只需要多一次操作,也即上帝视角可以反悔。 这个获得值就是拆成t份与拆成t - 1份之后的二者平方和的差。 参 阅读全文
posted @ 2021-01-12 13:18 LegendN 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 抄完韩教代码感觉自己本来也应该想出这种方法的。。。 这道题搁置了有一段时间了 总结一下 本题给出字符串s,要求在其中截取长度为k的01串共n-k+1个,问能不能找出一个字典序最小的、长度也为k的01串,使得这个结果串与n-k+1中每一个串至少有一位相同。 其实答案也挺暴力的,但也有一定的特殊性。对于 阅读全文
posted @ 2021-01-11 23:18 LegendN 阅读(98) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页