Graph Theory
文章平均质量分 61
kybconnor
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
4道 Uva 并查集
上周做的=.=没发上来.导致文件夹内大量cpp...今天在学活从6点切到了9:30uva313AC排名1396呵呵=.=明天下午校赛,上午就不做题了,把实验选了,开心就好以上并查集 以及通过并查集实现的最小生成树459 - Graph Connectivity#includeint ft[30];void in_ft(int n){ int i;原创 2013-04-13 22:42:01 · 761 阅读 · 0 评论 -
Uva 423 - MPI Maelstrom
之前在hdu的一次小比赛中见到过1YFloyd#include#define inf (int)1e9#includeint g[110][110];int n;int main(){ int n; while(scanf("%d",&n)!=EOF){ int i,j,k; for(i=1;ij){ char s[100]; scanf("%s"原创 2013-04-13 22:17:00 · 862 阅读 · 0 评论 -
Uva 10397 - Connect the Campus
1Y并查集+最小生成树#include#include#include#include#define MAX 800struct edge{ int p,q; double w; bool operator < (const edge& b)const { return w<b.w; } };std::vectorL;int ft[MAX];void in_原创 2013-04-29 18:59:43 · 646 阅读 · 0 评论 -
Poj 2253 Frogger
1WA于最小生成树改用floyd2WA于%.3lf3PE于没有数据间回车4AC#include#include#includeusing namespace std;#define MAX 210#define INF 1e20double G[MAX][MAX];double x[MAX],y[MAX];double dis(int p,int q){ d原创 2013-04-29 19:24:19 · 559 阅读 · 0 评论 -
Poj 1789 Truck History
1Yprim模板一套完事大吉#include#include#include#define INF ((int)1e9)#define N 2010using namespace std;int G[N][N];int low[N];char map[N][10];int cmp(int x,int y){ int len=strlen(map[x]);原创 2013-04-29 20:34:44 · 593 阅读 · 0 评论 -
Poj 1251 Jungle Roads
最小生成树 Kruskal oj有bugRE3次因为scanf第一次用cin输入没问题貌似是输入的问题以上#include#include#include#include#define MAX 800#includeusing namespace std;struct edge{ int p,q; int w; bool operator < (co原创 2013-04-29 19:52:17 · 587 阅读 · 0 评论 -
Poj 1258 Agri-Net
裸的最小生成树学习了下prim裸打的1Y#include#include#define INF ((int)1e9)#define N 110using namespace std;int G[N][N];int low[N];int main(){ int n; while(scanf("%d",&n)!=EOF){ int i,j;原创 2013-04-29 20:22:25 · 569 阅读 · 0 评论 -
Poj 2485 Highways
Prim最小生成树的最长边1Y改改模板就过了#include#include#define INF ((int)1e9)#define N 510using namespace std;int G[N][N];int low[N];int main(){ int n; int T; scanf("%d",&T); while(T原创 2013-04-29 20:29:08 · 546 阅读 · 0 评论 -
poj 1861 Network
最小生成树,要求构建和最大边最小1Y实例有一条边没用不过不影响#include#include#include#include#define MAX 1010using namespace std;struct edge{ int p,q; int w; int ok; bool operator < (const edge& b)const { retur原创 2013-04-29 20:47:34 · 569 阅读 · 0 评论 -
Poj 1797 Heavy Transportation
2Y表示英文水平急剧下降....我的6级肿么办到头来是最大生成树最短边#include#include#includeusing namespace std;#define N 1010#define INF (int)1e9struct line{ int l,r,w; bool operator tp.w;} }tp;int ft[N];int find(原创 2013-05-04 18:24:52 · 600 阅读 · 0 评论 -
Poj 2513 Colored Sticks
欧拉图判定(并查集,端点度数)离散化Bsearch1Y#include#include#include#include#define N 250003 using namespace std;struct chop{ char s[12]; bool operator < (const chop &tp)const{return strcmp(s,tp.s)<0;}原创 2013-05-03 22:49:58 · 631 阅读 · 0 评论 -
Poj 1125 Stockbroker Grapevine
floyd模板提居然0ms同时也是英语阅读题....google翻译什么的3Y表示没有判断n=0的情况breakpoj你到底是什么数据,,,,然后disjiont注释掉也能过orz#include#include#includeusing namespace std;#define N 110#define INF (int)1e9int G[N][N]原创 2013-05-04 17:35:04 · 678 阅读 · 0 评论 -
CF 219D (#135div.2)D. Choosing Capital for Treeland
今天积分赛的最后一道题目TLE是因为自己太二了...总体的时间复杂度是O(n^2)而不是O(n);因为in(u,v)的函数连二分都没有写...必须TLEorz...真的是....好吧,,,下次注意子函数的复杂度好忧伤啊...又优化了一下...G完全可以只存反向边...orz#include#include#include#define N 2000原创 2013-05-05 21:00:50 · 1003 阅读 · 1 评论 -
Poj 1459 Power Network
几乎就是裸的最大流对于多源点多汇点的最大流问题,只需要虚拟一个总源点总汇点即可虽然之前在读题的时候想到了这样描述出来是被题解第一行剧透的。。。orz1Y用的是1273ditch的EK模板1273就不放上来了,太水了。。。#include#include#include#define INF (int)1e9#define N 510#define FOR(原创 2013-05-07 21:13:38 · 653 阅读 · 0 评论 -
Poj 1149 PIGS
网络流的建模果然是一个难点这倒题目貌似还是比较简单的建模为了不继续在大物课上嚣张敲代码和自己已经没有思路了就看的题解从源点到中间节电的流量为每个猪库的猪数也想到了可以转移的中间节点的流量为INF也想到了代表顾客的点到汇点的流量是顾客需求只是中间节电构造没有想到很pl的通过把顾客有钥匙转化为那个猪库的钥匙在谁的手里然后这个猪库就相当于在这帮有钥匙的人之间传原创 2013-05-08 16:24:12 · 715 阅读 · 0 评论 -
Poj 1087 A Plug For UNIX
2Y1WA于以为插销只是一个字符2Y 0msZoo 的隐藏boss读的题自己建的模,还不错虚拟总源点,总汇点然后离散化所有的插座代号有的插座作为汇点有的电器作为源点转换器的边流量为INF以上#include#include#include#include#includeusing namespace std;#define N 510#de原创 2013-05-08 16:18:26 · 681 阅读 · 0 评论
分享