Beautiful Land #include<cstdio>价值背包 #include<cstdlib> #include<iostream> #include<algorithm> #include<cmath> #include<cstring> #include<map> #define m ...
分类:
其他好文 时间:
2020-05-03 20:35:46
阅读次数:
57
"题目链接" 题意 给定一条链,链上有n个结点,每个点有一个点权 试为每个点分配一个正整数,使得: 若两个相邻点的点权相等,则他们分配的数字也相等 否则点权大的点分配的数字应比点权小的大 分析 这道题其实写起来不是很难,但是思路可能有一点难想吧。 我们发现,如果只考虑上升的序列,这道题就很简单,就直 ...
分类:
其他好文 时间:
2020-05-03 18:36:44
阅读次数:
54
1 #include<iostream> 2 #include <map> 3 #include <string> 4 #include <cstring> 5 using namespace std; 6 map<string, long long int> num;//某话题出现次数 7 int ...
分类:
其他好文 时间:
2020-05-02 19:06:10
阅读次数:
197
http://acm.hdu.edu.cn/showproblem.php?pid=1042 代码 无结构体: #include<iostream> #include<string> #include<cstring> #include<algorithm> using namespace std; ...
分类:
其他好文 时间:
2020-05-02 12:16:52
阅读次数:
73
做法 结论 如果图的所有连通块的点数都是偶数,则可以选出一个生成子图,满足点的度数均为奇数。 首先因为度数和是偶数,所以如果每个点的度数是奇数,点数一定是偶数。 然后在一个偶数连通块内任选一个有根生成树,自下而上地对于度数为偶数的点删去它与父亲的连边。注意到度数和是偶数,而除根之外的所有点度数都被调 ...
分类:
其他好文 时间:
2020-05-02 11:27:53
阅读次数:
44
本题我们可以把物品当作一个点,并且设立一个虚拟原点,然后加上一个限制是不能超过m个等级 因此枚举每个范围求一遍最短路就行,因为我们发现等级差距并不是很大,注意,酋长不一定是最大等级 #include <cstring> #include <iostream> #include <algorithm> ...
题解就是求可重路径覆盖之后最大化剩余点的最小权值二分答案后就是一个可重复路径覆盖处理出可达点做二分图匹配就好了 #include<cstdio> #include<cstring> #include<algorithm> #define gc getchar() #define pc putchar ...
分类:
其他好文 时间:
2020-05-02 00:05:32
阅读次数:
65
题 复合词(Compound Words,UVa 10391)。题目详情看这个:https://www.jianshu.com/p/7c43fb5f2ecd #include <iostream> #include <cstring> #include <string> #include <set> ...
分类:
其他好文 时间:
2020-05-01 23:48:04
阅读次数:
62
http://acm.hdu.edu.cn/showproblem.php?pid=1002 代码 #include<iostream> #include<string> #include<cstring> #include<algorithm> struct bignum { int list[2 ...
分类:
其他好文 时间:
2020-05-01 20:15:31
阅读次数:
49
树状数组 资料借鉴: "https://www.luogu.com.cn/problemnew/solution/P3374" 适用范围 单次查询时间复杂度: O(logN) 区间和、区间异或和、区间乘积和静态RMQ 支持单点、区间修改 形式 红点是树状数组,白点是原信息数组 对于树状数组中的 每一 ...
分类:
编程语言 时间:
2020-05-01 18:55:28
阅读次数:
74