摘要: GTMD天天爱跑步 #include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<vector> using namespace std; const int N=319998,P=300001; int 阅读全文
posted @ 2017-10-20 20:55 探险家Mr.H 阅读(175) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std;int match[maxn],link[maxn][maxn],used[maxn],ans; bool find(int u) { memset(used,0,sizeof(used)); /*for(int i=first[u]... 阅读全文
posted @ 2017-10-20 20:25 探险家Mr.H 阅读(192) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> using namespace std; int t[250010][26]; in 阅读全文
posted @ 2017-10-20 20:15 探险家Mr.H 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 卡特兰数 打表 滑稽 #include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cmath> #include<cstring> using namespace std; string cat 阅读全文
posted @ 2017-10-20 17:50 探险家Mr.H 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 背包问题小合集 01背包 完全背包 多重背包混着来 对于01背包:把它想象成最大物品数为1的多重背包 对于完全背包:把它想象成最大物品数为m/w[i]的多重背包 对于多重背包:把它想象成。。。等等这本来就是个多重背包 数据比较水 但是我也写了个倍增优化 #include<iostream> #inc 阅读全文
posted @ 2017-10-20 17:47 探险家Mr.H 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 多重背包问题 一开始我们的转移方程是 然后我们发现T了 有一个简单的优化 最内层k是从0-c[i]相当于一条链 对于一条链我们很容易想到倍增 然后我们优化: 对于第i个物品,我们把它拆成若干份:取1个 取2个 取4个 取8个 ... 取2^(一大堆)个 取剩下的那么多个 这样可以把最内层循环变成lo 阅读全文
posted @ 2017-10-20 17:44 探险家Mr.H 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 因为一开始给出的是中序遍历 所以这其实是一道区间dp。。。 dp的同时记一下每个点的儿子就可以完成第二问 #include<iostream> #include<cstdio> using namespace std; int a[32],n,f[32][32],crf[32][32]; long 阅读全文
posted @ 2017-10-20 17:39 探险家Mr.H 阅读(108) 评论(0) 推荐(0) 编辑
摘要: dp[i]表示1~i最大效率 记一下前缀和 转移就是f[i]=max(f[i],f[j-1]-sum[j])+sum[i] (i-k<=j<=i) 发现括号里的只与j有关 开一个单调队列维护一下 阅读全文
posted @ 2017-10-20 17:37 探险家Mr.H 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 惊了呀 Splay Treap 这都什么玩意 两个优先队列搞定 #include <bits/stdc++.h> using namespace std; #define LL long long typedef pair<int,int> pii; const int inf = 0x3f3f3f 阅读全文
posted @ 2017-10-20 17:33 探险家Mr.H 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 背包问题加强版orz #include<iostream> #include<cstdio> #include<cmath> #include<cstring> using namespace std; long long a[500][500],f[500],n,m,a1[500],b1[500] 阅读全文
posted @ 2017-10-20 17:30 探险家Mr.H 阅读(148) 评论(0) 推荐(0) 编辑
摘要: dp[i][j]表示走i分钟疲劳值为j时的最远距离 然后搞一下就好啦 #include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> #include <cmath> # 阅读全文
posted @ 2017-10-20 17:29 探险家Mr.H 阅读(134) 评论(0) 推荐(0) 编辑