喵渺淼妙的死忠粉
喵渺淼妙的死忠粉
全部文章
分类
DP专题(42)
多校补题(2)
数据结构(19)
日记(6)
未归档(35)
题解(248)
归档
标签
去牛客网
登录
/
注册
喵渺淼妙的死忠粉的博客
TA的专栏
342篇文章
0人订阅
lpt的小屋
337篇文章
3316人学习
树的直径
「火」皇家烈焰
AtCoder思维大提升
5篇文章
81人学习
Valid payments
Revenge of BBuBBBlesort!
kuangbin专题记录
0篇文章
0人学习
全部文章
(共351篇)
树的直径
来自专栏
之前一个题目求树的直径,我是暴力树形dp的..但是其实是有个性质的,树的直径一定是含有一个深度最深的点.反证法:假如我当前树的直径不含深度最深的点,那么我一定存在一条路径从深度最深的点到另外一个点的距离比当前dis更大,因为树上任意两点都是有路径的.而树上路径的距离公式是.那么假设我现在最深的点到其...
证明
2021-01-20
3
2
「火」皇家烈焰
来自专栏
直接按题意模拟dp即可.. #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e6+5,M=2; const int mod=1e9+7; char s[N]; ll f[N]...
dp
2021-01-20
3
3
珂朵莉的数列
来自专栏
emmm,我觉得是水题.另外存下__int128的输入输出~好困啊! #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e6+50; ll n; ll w[N],c[N],va...
树状数组
__int128
2021-01-20
0
2
Running Median
来自专栏
进阶指南原题(对顶堆一下.),原来快读可以减少空间. #include <bits/stdc++.h> using namespace std; inline int read() { int s = 0, w = 1; char ch = getchar(); whil...
优先队列
2021-01-20
1
2
过河
来自专栏
把数组开到极限,以及将可以在中间转化的值全部消除然后进行dp即可. #include <bits/stdc++.h> using namespace std; const int mod=2*3*4*5*6*7*8*9*2; const int N=1e2+5; const int M=...
dp
2021-01-20
2
4
背包
来自专栏
我觉得直接二分答案就好了,不需要讨论,只需要将数组按容量大小排序。我觉得答案是有二分性的。
二分
2021-01-18
1
9
旅游
来自专栏
思路: 简单的思考一下,这题就是没有上司的舞会.首先,我假如选了这个点,那么它的子节点都不能选,假如我这个点选了的话,那么它的子节点既可以选,又可以不选. 代码: #include <bits/stdc++.h> using namespace std; const int N=5e5+...
树形dp
2021-01-16
3
16
New Year Tree
来自专栏
回去再调. #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=4e5+5; ll col[N]; vector<int>g[N]; int now[N],last[N...
树链剖分
2021-01-15
2
23
[HAOI2006]旅行COMF
来自专栏
思路: 判断两点是否联通,可以用并查集来判断.如果起点和终点联通了,那么我们不妨枚举最大边是多少,然后按顺序枚举那条较小边是多少.然后取个min就是最终的答案了. 代码: #include <bits/stdc++.h> using namespace std; const int N=...
DSU
2021-01-14
3
19
(构造一个水题留着以后无聊出比赛用.)
来自专栏
#include <bits/stdc++.h> using namespace std; const int N=105; int f[N];//从0跳到当前石头最少需要几次. int pos[N]; int main() { int l;scanf("%d&quo...
dp
2021-01-13
0
17
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页