摘要: C. Anagramtime limit per test1 secondmemory limit per test256 megabytesStringxis ananagramof stringy, if we can rearrange the letters in stringxand get exact stringy. For example, strings "DOG" and "GOD" are anagrams, so are strings "BABA" and "AABB", but stri 阅读全文
posted @ 2012-12-10 23:08 yefeng1627 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 题目大意: 有K个挤奶器,C头奶牛,每个挤奶器最多能给M头奶牛挤奶。求使C头奶牛头奶牛需要走的路程的最大路程最小。解题思路: 使用Floy预先求出任意两点间最短距离,然后二分枚举最大距离. 构图方案: 源点与奶牛连边,容量为1, 挤奶器与汇点连边,容量为M, 奶牛与挤奶器连边 (注意,这里只有单项边) 还要注意的是,因为预先求过最短路,初始化的时候对于0的边,赋值的无穷大不要设的太大,不然会溢出.参考代码: SAP(shortest augment path) 间隙优化, AC时间 110ms View Code #include<stdio.h>#include<stdli 阅读全文
posted @ 2012-12-10 21:13 yefeng1627 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 解题思路: 源点为1,汇点为N, 直接求最大流就好View Code #include<stdio.h>#include<string.h>#include<string.h>#define MIN(a,b) (a)<(b)?(a):(b)const int inf = ~0u>>1;const int MAXN = 210;int n, m, S, T, N;int head[MAXN], idx, h[MAXN], vh[MAXN];struct Edge{ int v, f, nxt; }edge[MAXN<<4];voi 阅读全文
posted @ 2012-12-10 19:39 yefeng1627 阅读(146) 评论(0) 推荐(0) 编辑
摘要: PIGSTime Limit:1000MSMemory Limit:10000KTotal Submissions:12924Accepted:5721DescriptionMirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doesn't have the keys. Customers come to the farm one after another. Each of them has keys to s 阅读全文
posted @ 2012-12-10 19:06 yefeng1627 阅读(138) 评论(0) 推荐(0) 编辑

Launch CodeCogs Equation Editor