摘要:
题目:http://poj.org/problem?id=1258完全模板题。。。和大水题poj 2485一样。。。目的:增强自信心。。。代码:#include #include using namespace std;
const int maxn = 500; struct Edge{ int x, y, w;
};
Edge e[maxn*maxn];
int f[maxn];
int v[maxn][maxn]; int find(int x) { if (x != f[x]) return f[x] = find(f[x]); return x;
} bool c... 阅读全文
posted @ 2013-06-13 20:08
程序流程图
阅读(135)
评论(0)
推荐(0)
摘要:
rt,超级大水题,连邻接矩阵都给出来了,求最小生成树的最大边。。。继续用kruscal切掉。。。代码:#include #include using namespace std;
const int maxn = 500; struct Edge{ int x, y, w;
};
Edge e[maxn*maxn];
int f[maxn];
int v[maxn][maxn]; int find(int x) { if (x != f[x]) return f[x] = find(f[x]); return x;
} bool cmp(Edge a, Edge b) {
... 阅读全文
posted @ 2013-06-13 19:57
程序流程图
阅读(188)
评论(0)
推荐(0)
摘要:
继续水水题。。。题目:http://poj.org/problem?id=1789把车看成结点,车之间的距离看作权重就是一个图了,然后求最小生成树。。。的确水题,但看题目花了挺长时间,不知道如果现场遇到这种题目会多蛋疼。。。这题时限2000ms,但用kruscal+sort写出来wa了,换用qsort的话果断超时了,翻了下网上的题解,发现貌似得用const void *传入参数才能快点。修改完发现又wa了,然后gdb调了一遍,最后发现输出忘了个.。。。无语死。。。额,后来是sort 1200+ms,qsort 600+ms。。。贴代码(qsort):#include #include us.. 阅读全文
posted @ 2013-06-13 19:20
程序流程图
阅读(174)
评论(0)
推荐(0)

浙公网安备 33010602011771号