摘要: #include<cstdio>#include<algorithm>using namespace std;typedef long long ll ;struct my{ ll next; ll v;};const int maxn=500000+20;my tu[maxn];ll d[maxn 阅读全文
posted @ 2018-03-04 19:27 lmjer 阅读(125) 评论(0) 推荐(0) 编辑
摘要: #include<cstdio>#include<algorithm>#include<cstring>using namespace std;struct my{ int v; int next;};const int maxn=200000+10;my tu[maxn];int size[max 阅读全文
posted @ 2018-03-04 09:32 lmjer 阅读(135) 评论(0) 推荐(0) 编辑
摘要: #include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct my{ int u,v,next;};const int maxn=100000+5;int cnt;int nil=1000000000;m 阅读全文
posted @ 2018-03-01 18:40 lmjer 阅读(154) 评论(0) 推荐(0) 编辑
摘要: int read(){ int p,data=0; char ch=0; while ((ch!='-') && ch<'0' || ch>'9') ch=getchar(); if (ch=='-') { p=-1; ch=getchar(); } else p=1; while (ch>='0' 阅读全文
posted @ 2018-03-01 18:40 lmjer 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 动态规划类型总结 1.最长上升子序列,最大连续子序列和最长公共子序列(zxh,415--430,556--560,587--591,uva 11400,uva 11584,uva1625) 2.背包问题(uva 12563,金明的预算方案) 3.区间DP(zxh,488--502,算法导论相应题目) 阅读全文
posted @ 2018-02-24 11:21 lmjer 阅读(944) 评论(0) 推荐(0) 编辑
摘要: 1.动态规划是什么? 就是很高级的大暴力啊!,打暴力的时候把值存起来避免重复计算,用来求组合优化问题的 一个玄学东西; 2.如何确定状态及转移方程? 一般思路先把暴力打出来吧,,说不定打打暴力(就像第一次做数字三角,,,暴力出dp)就把状态和转移方程找到了(鄙人觉得做动规前 先打暴力,一是避免翻车, 阅读全文
posted @ 2018-02-07 13:06 lmjer 阅读(118) 评论(0) 推荐(0) 编辑
摘要: int read(){ int x=0; char c; c=getchar(); while(c<'0'||c>'9') c=getchar(); while(c>='0'&&c<='9') { x=x*10+c-'0'; c=getchar(); } return x; } struct io 阅读全文
posted @ 2018-02-03 14:10 lmjer 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 最大独立集与最小顶点覆盖互补 阅读全文
posted @ 2018-01-30 18:18 lmjer 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 匹配:一个图中选出一些边来使得任意边所连接的顶点不同, 最大匹配:边数最多的匹配 最大权匹配:边权最大的匹配 完美匹配:所有节点都包括的匹配 覆盖:无向图的一个顶点子集,使得边集中任意一条边都至少一个顶点在这个子集中 最小边覆盖:点最少的覆盖 最小边覆盖数=最大匹配数 独立集:一个无向图中不存在一条 阅读全文
posted @ 2018-01-30 11:48 lmjer 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 二分图最小覆盖数=最大匹配数 建模后即可 #include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct my{ int next; int v;};const int maxn=1000000+10;co 阅读全文
posted @ 2018-01-30 11:27 lmjer 阅读(107) 评论(0) 推荐(0) 编辑