- 博客(9)
- 收藏
- 关注
原创 每日一题 4月8日 黑白树 树形DP
题目链接:https://ac.nowcoder.com/acm/problem/13249 #include<bits/stdc++.h> #define LL long long using namespace std; int k[100005], f[100005]; int ans=0; vector<vector<int> > v(10000...
2020-04-07 15:08:39 331
原创 每日一题 4月7日 树 dfs序+DP
题目链接:https://ac.nowcoder.com/acm/problem/13611 #include <bits/stdc++.h> #define LL long long using namespace std; const int mod=1e9+7; LL f[305][305]; int main(){ int n, m; scanf("%d%d...
2020-04-07 15:07:06 264
原创 牛客OI周赛15-提高组 A 环球旅行-树的直径
题目链接:https://ac.nowcoder.com/acm/contest/4912/A #include <bits/stdc++.h> #define LL long long using namespace std; struct E{ int to, w; E(int a, int b){ to=a; w=b; } }; ...
2020-04-07 15:05:30 239
原创 学军信友队趣味网络邀请赛 A-B-D 思维+树形DP/直径+数论
题目链接:http://115.236.49.52:83/contest/1351 题解:假设n是奇数。n如果是偶数,翻转90度就可以了。 B: #include <bits/stdc++.h> using namespace std; #define LL long long vector<vector<int> > v(50005); int...
2020-04-07 15:02:48 349
原创 牛客OI周赛15-普及组 B 三角形+D 多元组 DP
B: #include <bits/stdc++.h> #define LL long long using namespace std; int a[105][105]; LL f[105][10005]; int main(){ int n, k, m; scanf("%d%d", &n, &k); for(int i=1; i<=...
2020-04-07 14:58:24 212
原创 牛客OI周赛15-提高组 - 恢复数列
题目链接:https://ac.nowcoder.com/acm/contest/4912/B #include <bits/stdc++.h> #define LL long long using namespace std; vector<int> v; int main(){ int n, x; scanf("%d%d", &n, &x...
2020-04-07 14:55:10 150
原创 每日一题 4月3日 Shortest Path 树上贪心
题目链接:https://ac.nowcoder.com/acm/problem/13886 题意:有一棵树,有n个节点。让你分成n/2对。所有对之间的距离和最小。 思路:我们尽量让每条边不重复经过。那么对于一棵子树v。和他的父亲节点u。还有之间的边权w。如果siz[u]%2== 1那么v就和u连。ans+=w。如果siz[u]%2== 0那么v和自己的子树连过了。不加w的贡献。 #includ...
2020-04-02 20:08:04 195
原创 牛客练习赛60 旗鼓相当的对手 树上启发式合并
题目链接:https://ac.nowcoder.com/acm/contest/4853/E #include <bits/stdc++.h> using namespace std; #define LL long long typedef pair<LL, LL> pll; LL n, k, a[100005]; vector<vector<int&g...
2020-04-02 20:05:58 246
原创 每日一题 4月1日 Rinne Loves Edges 树形DP
题目链接:https://ac.nowcoder.com/acm/problem/22598?&headNav=acm #include<bits/stdc++.h> #define LL long long using namespace std; struct node{ LL to, w; }; vector<vector<node> ...
2020-04-01 16:06:23 149
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人