随笔分类 -  UVA

UVAOJ from LRJ
摘要:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文
posted @ 2014-11-03 22:59 Commence 阅读(189) 评论(0) 推荐(0)
摘要:#includeusing namespace std;int n;int dfs(int n){return n == 1 ? 1 : dfs(n / 2) + 1;}int main(){ while (cin >> n) cout << dfs(n) << endl; ... 阅读全文
posted @ 2014-11-03 22:55 Commence 阅读(160) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文
posted @ 2014-11-02 11:46 Commence 阅读(201) 评论(0) 推荐(0)
摘要:费用流 建图很简单直接上代码#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #... 阅读全文
posted @ 2014-10-29 17:34 Commence 阅读(548) 评论(0) 推荐(0)
摘要:并查集解决。代码跑的有够慢。应该可以通过边权排序优化。#include #include #include #include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文
posted @ 2014-10-26 23:53 Commence 阅读(243) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文
posted @ 2014-10-23 20:12 Commence 阅读(219) 评论(0) 推荐(0)
摘要:并查集#include#includeusing namespace std;#define MAXN 100005int p[MAXN],N;int Find(int x) {return x == p[x] ? x : p[x] = Find(p[x]);}int main(){ //fr... 阅读全文
posted @ 2014-10-16 22:33 Commence 阅读(222) 评论(0) 推荐(0)
摘要:最大流 。以航班为节点进行最大流。 容量限制进行拆点。 如果时间地点满足可以建一条边。 具体看代码。变量名被修改过了。一开始的变量名可能比较容易看懂但CE了。可能与库里的变量重复了。AC代码#include #include #include #include #include #include #... 阅读全文
posted @ 2014-10-16 13:52 Commence 阅读(325) 评论(0) 推荐(0)
摘要:题意:求点联通度首先看了别人的题解还是不晓得只枚举汇点的原因觉得行不通关于求点联通度的建图方法 转自http://hi.baidu.com/lerroy312/item/5a5f36f2f5bba61bcf9f322e点连通度的定义:一个具有N个点的图G中,在去掉任意k-1个顶点后(1=2,则任意K... 阅读全文
posted @ 2014-10-15 22:24 Commence 阅读(286) 评论(0) 推荐(0)
摘要:裸的费用流。一开始因为这句话还觉得要拆点 样例行不通不知道这句话干啥用的。Further, the company cannot place the two chemicals in same depot (for any length of time) without special storag... 阅读全文
posted @ 2014-10-15 13:39 Commence 阅读(201) 评论(0) 推荐(0)
摘要:主要时floyd判断出利用飞鞋生成的DIS 。其他SPFA或DIJKSTRA都可以#include #include #include #include #include #include #include #include #include #include #include #include #... 阅读全文
posted @ 2014-10-15 12:08 Commence 阅读(200) 评论(0) 推荐(0)
摘要:并查集的应用直接阔成2倍。后N项为对应的敌人#include #include #include #include #include #include #include #include #include #include #include #include #include #include #i... 阅读全文
posted @ 2014-10-14 19:57 Commence 阅读(175) 评论(0) 推荐(0)
摘要:很水的并查集#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ... 阅读全文
posted @ 2014-10-14 13:29 Commence 阅读(146) 评论(0) 推荐(0)
摘要:最短路 参考了Staingger的博客感觉DP的状态记录还是有毛病。可以DFS寻找结果也。#include #include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文
posted @ 2014-10-14 13:28 Commence 阅读(221) 评论(0) 推荐(0)
摘要:无向图费用流还有一段话摘自别人博客这道题是无向图的最小费用最大流问题,看清楚是无向图的。这么说无向图和有向图的费用流问题有什么区别呢?主要是反向边的问题。首先我们说一下最大流问题中的反向边,我们需要将其cap[u][v]=0表示容量为0,而在费用流问题中添加了费用,所以肯定不能像之前那么简单处理了,... 阅读全文
posted @ 2014-10-13 20:05 Commence 阅读(351) 评论(0) 推荐(0)
摘要:最小费用最大流 源点->警察->bank->汇点剩下的模板就可以#include #include #include #include #include #include #include #include #include #include #include #include #include #... 阅读全文
posted @ 2014-10-13 13:25 Commence 阅读(259) 评论(0) 推荐(0)
摘要:最大流解决 。设置源点 0,连接所有设备(device) 。设备-插头 -汇点#include #include #include #include #include #include #include #include #include #include #include #include #in... 阅读全文
posted @ 2014-10-12 15:41 Commence 阅读(216) 评论(0) 推荐(0)
摘要:一开始就想到网络流。。后来一想暴力能不能过。自己写的T了。看了别人有暴力过的。暴力的思路就是6进制数字表示给予的衣服的数量。然后每个人的需求表示成01 的6位串然后爆搜。网络流就建一个源一个汇 然后针对输入 i - i + 6 边权为N/6; 然后M个人由衣服连M个人边权为1。与源直接相连的点就IN... 阅读全文
posted @ 2014-10-12 11:50 Commence 阅读(307) 评论(0) 推荐(0)
摘要:直接暴力模拟 。以每次还未被删除的cnt[i]为一周期进行暴力模拟#include #include #include #include #include #include #include #include #include #include #include #include #include ... 阅读全文
posted @ 2014-10-11 23:51 Commence 阅读(285) 评论(0) 推荐(0)
摘要:费用流第一题主要是临街表实现这个算法的问题。这里存下思路还是比较简单。源点0,汇点N+1.费用为边长。容量为1.(普通边)。添加边为2(0-1 N-N+1)代码#include #include #include #include #include #include #include #includ... 阅读全文
posted @ 2014-10-11 18:29 Commence 阅读(221) 评论(0) 推荐(0)