摘要: 链接:http://wikioi.com/problem/1021/这题挺有意思的,虽然比较水,但是让我想起来那次百度or腾讯的一道最大流的题目,很给力,也是对最后找边进行优化,不过这题比那题简单多了,找出最短路,然后对最短路上的变进行一下标记,最后找边的时候只招最短路上的边就可以了。代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #define loop(s,i,n) for(i = s;i q;42 q... 阅读全文
posted @ 2013-09-27 14:14 某某。 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 链接:http://wikioi.com/problem/1035/怎么说呢,只能说这个建图很有意思。因为只有m条道,然后能互相接在一起的连通,对每个点进行拆点,很有意思的一道裸费用留题。代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 const int maxn = 350; 9 const int inf = 10000000; 10 struct node 11 { 12 int u,v,cap,flow,co... 阅读全文
posted @ 2013-09-27 14:10 某某。 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 中文题意不描述。链接:http://wikioi.com/problem/1028/这题一开始很裸的最大权二分匹配。但是原来没有接触过,KM的这个最大权不大会。然后一开始以为用最大费用最大流直接就能搞,后来知道单纯的费用流解决的是二分最佳匹配,而不是最大权,QCMM然后看了一下这个http://hi.baidu.com/lerroy312/item/42e718ba58a1f8df85dd795f结果改了之后不对,不知道为什么最后用的最小费用,对边的权值取负值,结果取负值才过。。。不解。。。 1 #include 2 #include 3 #include 4 #include ... 阅读全文
posted @ 2013-09-27 14:06 某某。 阅读(482) 评论(0) 推荐(0) 编辑