上一页 1 ··· 9 10 11 12 13 14 下一页
摘要: 题意:有n头牛,有m条连接n头牛的路。有一个牛k,所有牛都需要走到牛k处并返回(去的路与回的路距离不同)。求所有牛都最快回到原地处的最大时间。 题解:做这道题的时候,其实并没有想到官方题解。想的是用Dijkstra求出每个牛去和回的最小路相加的最大值。结果用普通的Dijkstra T了。后面用优先队 阅读全文
posted @ 2017-08-21 10:31 LMissher 阅读(238) 评论(0) 推荐(0)
摘要: hdu终于100题了 嘎嘎嘎嘎嘎 题意:有n个人,一些人认识另外一些人,选取一个集合,使得集合里的每个人都互相不认识,求该集合中人的最大个数。 题解:这题就是求最大独立集,但是这并不是两个集合,而是一个集合,所以求出最大匹配后需要/2,然后代公式:最大独立集=N-最大匹配。最大匹配直接用匈牙利算法求 阅读全文
posted @ 2017-08-20 11:48 LMissher 阅读(105) 评论(0) 推荐(0)
摘要: 题意:有p个课程,n个学生,每个课程有x个学生喜欢。如果每个课程都至少可以分配一个学生就输出YES,否则输出NO。 题解:匈牙利算法裸题。 代码: #include <cstdio>#include <cstring>#define N 400int Map[N][N],S[N],vis[N],n; 阅读全文
posted @ 2017-08-20 11:23 LMissher 阅读(181) 评论(0) 推荐(0)
摘要: 题意:有x个男生各自有喜欢的女生,y个女生各自有喜欢的男生。互相喜欢的在一起有好感度。问怎样好感度最高。 题解:匈牙利算法裸题。 代码: #include <cstdio>#include <cstring>#define N 1500int Map[N][N],M[N],vis[N];int k, 阅读全文
posted @ 2017-08-20 11:04 LMissher 阅读(117) 评论(0) 推荐(0)
摘要: 题意:网络流模板题,求1到n的最大流,直接写模板。 代码: #include <cstdio>#include <algorithm>#include <queue>#include <cstring>#define N 30#define INF 1000000using namespace st 阅读全文
posted @ 2017-08-20 09:23 LMissher 阅读(144) 评论(0) 推荐(0)
摘要: 题意:网络流的裸题,1为源点,n为汇点,给定每条边的容量,求最大流,用EK算法。 代码: #include <cstdio>#include <queue>#include <algorithm>#include <cstring>#define N 300#define INF 0x7ffffff 阅读全文
posted @ 2017-08-19 16:15 LMissher 阅读(197) 评论(0) 推荐(0)
摘要: C. Leha and Function time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output C. Leha and Functio 阅读全文
posted @ 2017-08-19 12:41 LMissher 阅读(609) 评论(0) 推荐(0)
摘要: B. Godsend time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output B. Godsend time limit per tes 阅读全文
posted @ 2017-08-19 12:31 LMissher 阅读(399) 评论(0) 推荐(0)
摘要: 模板: //初始化a,因为有last,所以这里无需初始化其他位 a[0]=1; int last=0; for (int i=0;i<K;i++) { int last2=min(last+n[i]*v[i],P);//计算下一次的last memset(b,0,sizeof(int)*(last2 阅读全文
posted @ 2017-08-18 10:59 LMissher 阅读(143) 评论(0) 推荐(0)
摘要: B. 3-palindrome time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output B. 3-palindrome time limi 阅读全文
posted @ 2017-08-15 10:37 LMissher 阅读(164) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 下一页