近期总结
2010-09-02 15:45
106 查看
选拔赛要开始了,最近一直在刷题。DP居多,线段树其次,感觉这两方面的进步非常的大,假期的集训没有白费。
DP还是卡了几个题的,线段树的内容:火星地图和阿特兰迪斯都过了,自己感觉线段树的思想理解的更深刻了,继承统计的优化,在这个过程中,还学习到了扫描线离散化能内容,以后需要多做题巩固一下。网络流……不太能做下去,感觉现在建图上遇到了瓶颈,狂刷二分图的时候留下了一些功底,但是可惜的是对网络流的流量,费用上的灵活运用帮助不大,也可能是我自己不能灵活运用的原因。选拔赛希望有个好结果,之后又是一段时间的学习了,ACM可能要放下,呃,不想学习那些没用个课……毛概什么的无聊,老师……唉就不说了。
说一个解题报告。poj2724二分图,之前一直没读懂题,今天再来看看,是水题呀……
做完之后看了解题报告,发现一个非常好用的东西,求2个数的二进制表示法是否只差1位!
方法看代码吧
代码
接下来的工作,整理模板。准备选拔赛,刷几个网络流,再复习复习一些数据结构什么的,搜索就那样了吧,一个假期都没有做过什么像样的搜索,唉……70大神的搜索题至今没AC……,淡定吧
DP还是卡了几个题的,线段树的内容:火星地图和阿特兰迪斯都过了,自己感觉线段树的思想理解的更深刻了,继承统计的优化,在这个过程中,还学习到了扫描线离散化能内容,以后需要多做题巩固一下。网络流……不太能做下去,感觉现在建图上遇到了瓶颈,狂刷二分图的时候留下了一些功底,但是可惜的是对网络流的流量,费用上的灵活运用帮助不大,也可能是我自己不能灵活运用的原因。选拔赛希望有个好结果,之后又是一段时间的学习了,ACM可能要放下,呃,不想学习那些没用个课……毛概什么的无聊,老师……唉就不说了。
说一个解题报告。poj2724二分图,之前一直没读懂题,今天再来看看,是水题呀……
做完之后看了解题报告,发现一个非常好用的东西,求2个数的二进制表示法是否只差1位!
方法看代码吧
代码
#include <iostream> #include <vector> #include <cstdio> #include <cstring> using namespace std; class max_match { private: const int static size = 1100; vector<int> adj[size]; int nx, ym[size]; bool check[size]; int infect[size]; bool find_path(int x); public: bool init(); void slove(); } g; bool max_match::find_path(int x) { int s = adj[x].size(), w; for (int i = 0; i < s; i++) { w = adj[x][i]; if (!check[w]) { check[w] = true; if (ym[w] == -1 || find_path(ym[w])) { ym[w] = x; return true; } } } return false; } bool max_match::init() { int n, m; char str[size]; if (scanf("%d %d", &n, &m) != 2) return false; if (n == 0 && m == 0) return false; nx = 0; memset(ym, -1, sizeof (ym)); memset(check, false, sizeof (check)); for (int i = 0; i < m; i++) { scanf("%s", str); int res = 0, tmp = 0; for (int j = 0; str[j]; j++) { res <<= 1; tmp <<= 1; if (str[j] == '*') tmp = 1; else res += str[j] - '0'; } check[res] = true; check[res + tmp] = true; } for (int i = 0; i < (1 << n); i++) if (check[i]) infect[nx++] = i; for (int i = 0; i < nx; i++) adj[i].clear(); for (int i = 0; i < nx; i++) for (int j = 0; j < nx; j++) { if (i == j) continue; int tmp = infect[i] ^ infect[j]; if (tmp && ((tmp & (tmp - 1)) == 0)) adj[i].push_back(j); } return true; } void max_match::slove() { int res = 0; for (int i = 0; i < nx; i++) { memset(check, false, sizeof (check)); if (find_path(i)) res++; } printf("%d\n", nx - res / 2); } int main() { while (g.init()) g.slove(); return 0; }
接下来的工作,整理模板。准备选拔赛,刷几个网络流,再复习复习一些数据结构什么的,搜索就那样了吧,一个假期都没有做过什么像样的搜索,唉……70大神的搜索题至今没AC……,淡定吧
相关文章推荐
- 近期项目开发中的一些总结
- 近期学习javascript和jquery遇到一些问题的技巧知识总结
- 近期总结&比赛题解(稍后献上 正在码字......)
- 近期工作总结
- 影院平台搭建 - (10)近期总结
- 近期的生活及过去一年的工作总结
- 近期工作总结
- 环环相扣---近期自动测试经验总结
- MFS近期测试遇到故障的总结
- C/S协作 以及对近期工作的一点总结
- 近期工作中的错误总结
- 近期办事犯错总结-知行合一、知在行前-解决问题前,首先要搞清楚问题
- 近期刷题的c语言总结。
- js近期的研究总结
- redis近期踩的坑总结
- 近期项目总结之时间格式
- 近期面试的相关面试题总结
- 近期总结
- 近期学习javascript和jquery遇到一些问题的技巧知识总结
- 近期的几点总结