上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 25 下一页
摘要: 以前做过poj的一个判断图是否为弱连通的题,然后,这个题和poj那个差不多。先强连通缩点,然后重新构图,然后找出包含点数最多的链,统计个数即可,可以用拓扑排序搞~pS:重新构图时有重边,然后导致统计方案数的重复。。wa了好久。。还是wzc神犇告诉我这个蒟蒻的。。View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <algorithm> 6 7 #define N 200000 8 阅读全文
posted @ 2013-01-18 23:09 proverbs 阅读(1060) 评论(0) 推荐(0) 编辑
摘要: 这个经典的设问形式你难道没有心动么?这不是在提示你二分么?二分边权,然后并查集判定连通性,因为连通了一定会有最小生成树奥,第一问的答案是n-1应该没问题吧,View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 #include <cstdio> 6 7 #define N 1000 8 #define M 100000 9 10 using namespace std;11 12 struct 阅读全文
posted @ 2013-01-18 23:03 proverbs 阅读(662) 评论(0) 推荐(0) 编辑
摘要: 贪心。和田忌赛马差不多。但是更简单一些。最强的能赢就赢,最弱的能赢就赢,其他情况用最弱的拼对方最强的,感性想是这样的。。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algorithm> 6 7 #define N 200000 8 9 using namespace std;10 11 int n;12 long long a[N],b[N];13 14 inline 阅读全文
posted @ 2013-01-18 23:01 proverbs 阅读(792) 评论(0) 推荐(0) 编辑
摘要: 转移特别显然是n^2的,tle~然后由于转移没有区间限制,所以应该不是单调队列,然后想斜率优化吧。推了两张纸,证明了决策的单调性(我以前都是默认的单调。。。第一次证明。),嘿嘿。其实就是维护的一个下凸的函数。View Code 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <cstring> 6 7 #define N 1100000 8 9 using namespace std;10 阅读全文
posted @ 2013-01-18 22:59 proverbs 阅读(1028) 评论(0) 推荐(0) 编辑
摘要: 费用流。。一开始以为是贪心,后来看见数据范围,就想别的了。。。这题又是考构图的,省选的构图都好难啊。。。有没有想到。。关键就是把每个技术员拆成n个点,表示这个技术员倒数第几个修的车子。。考虑第i个工人,他修第j辆车只对后面要修的车有影响,而前面修过的车已经对当前没有影响了。而这个影响就是后面每个将要修理的车都多等待了time的时间。太绝了!View Code 1 #include <iostream> 2 #include <cstdlib> 3 #include <cstring> 4 #include <cstdio> 5 #include 阅读全文
posted @ 2013-01-18 22:54 proverbs 阅读(1520) 评论(0) 推荐(1) 编辑
摘要: 没居前两个格,然后剩下的所有格子情况就确定了~View Code 1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <cstring> 5 #include <algorithm> 6 7 #define N 11000 8 9 using namespace std;10 11 int gs[N],bh[N];12 int n,ans;13 14 inline void read()15 {16 scanf("%d" 阅读全文
posted @ 2013-01-18 22:50 proverbs 阅读(740) 评论(0) 推荐(1) 编辑
摘要: 内向树dp~就是先找环,任取环上有边相连两点,u和v,以u为根,断开u和v之间的边,做两次树形dp,dp[i][0]表示i不选,dp[i][1]表示i选①强制u不选,v随意②u随意,v不选两种情况取最大值即可~View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algorithm> 6 7 #define N 2000000 8 #define M 4000000 9 10 u 阅读全文
posted @ 2013-01-18 22:49 proverbs 阅读(1362) 评论(0) 推荐(0) 编辑
摘要: 暴力状压dp。。。好久不写状压dp,先水一个~View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <algorithm> 6 7 #define N 1000 8 9 using namespace std;10 11 int num,n,m;12 int zt[N],gs[N];13 long long dp[11][1<<11][90];14 bool map[N 阅读全文
posted @ 2013-01-18 22:45 proverbs 阅读(853) 评论(0) 推荐(0) 编辑
摘要: 按照t2从小到大排列之后贪心。若当前任务可以插入,则插入。若当前任务不可以插入,分两种情况:①当前任务的耗时大于等于之前插入的任务的最大耗时:跳过当前任务②当前任务的耗时小于之前插入的任务的耗时:将最前插入的耗时最大的那个任务删除,插入当前任务此过程用堆维护~View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <algorithm> 6 7 #define N 1000000 8 阅读全文
posted @ 2013-01-18 22:44 proverbs 阅读(1347) 评论(0) 推荐(0) 编辑
摘要: 传说中的主席树可以做!ym zxr神犇~此题目同:http://www.cnblogs.com/proverbs/archive/2013/01/17/2865123.htmlView Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algorithm> 6 #include <cmath> 7 #include <ctime> 8 9 #define N 1 阅读全文
posted @ 2013-01-17 20:09 proverbs 阅读(410) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 25 下一页